heliosdb-nano 3.30.0

PostgreSQL-compatible embedded database with TDE + ZKE encryption, HNSW vector search, Product Quantization, git-like branching, time-travel queries, materialized views, row-level security, and 50+ enterprise features
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
# HeliosDB Nano Configuration File (v2.1)
#
# This is a comprehensive example configuration file showing all available
# options for HeliosDB Nano. Copy this file to config.toml and customize
# as needed for your deployment.

# ============================================================================
# STORAGE CONFIGURATION
# ============================================================================
[storage]
# Database storage path (None or omit for in-memory database)
path = "./heliosdb-data"

# Memory-only mode (overrides path setting)
memory_only = false

# Write-Ahead Log (WAL) configuration
# WAL provides durability and crash recovery
wal_enabled = true

# WAL synchronization mode:
# - "sync": Synchronous (safest, slowest) - fsync on every write
# - "async": Asynchronous (faster, less safe) - OS-managed flush
# - "group_commit": Batch operations (balanced performance/safety)
wal_sync_mode = "sync"

# Maximum memory for cache (in bytes)
# Default: 512MB (536870912 bytes)
cache_size = 536870912

# Default compression type:
# - "None": No compression
# - "Zstd": Zstandard compression (recommended, good ratio and speed)
# - "Lz4": LZ4 compression (faster, lower ratio)
compression = "Zstd"

# Enable automatic time-travel versioning
# When true, all insert/update operations create versioned snapshots
# for time-travel queries (AS OF TIMESTAMP/TRANSACTION/SCN)
time_travel_enabled = true

# Query timeout in milliseconds (None or 0 for unlimited)
# Queries exceeding this duration will be automatically terminated
# Recommended: 30000 (30 seconds) for production
query_timeout_ms = 0

# Statement timeout in milliseconds (None or 0 for unlimited)
# Currently not implemented, reserved for future use
statement_timeout_ms = 0

# Transaction isolation level:
# - "READ_UNCOMMITTED": Not fully supported, maps to READ_COMMITTED
# - "READ_COMMITTED": Standard PostgreSQL default
# - "REPEATABLE_READ": Consistent snapshot from transaction start
# - "SERIALIZABLE": Strictest isolation, may cause serialization failures
transaction_isolation = "READ_COMMITTED"

# ============================================================================
# ENCRYPTION CONFIGURATION
# ============================================================================
[encryption]
# Enable encryption at rest
enabled = false

# Encryption algorithm (currently only AES-256-GCM supported)
algorithm = "Aes256Gcm"

# Key rotation interval in days
rotation_interval_days = 90

# Key source configuration
# Option 1: Environment variable
[encryption.key_source]
Environment = "HELIOSDB_ENCRYPTION_KEY"

# Option 2: File path (uncomment to use)
# [encryption.key_source]
# File = "/secure/path/to/encryption.key"

# Option 3: Cloud KMS (uncomment to use)
# [encryption.key_source.Kms]
# provider = "aws"  # aws, azure, or gcp
# key_id = "arn:aws:kms:us-east-1:123456789:key/abc-123"

# ============================================================================
# SERVER CONFIGURATION
# ============================================================================
[server]
# Listen address (use "0.0.0.0" to accept connections from any IP)
listen_addr = "127.0.0.1"

# PostgreSQL protocol port
port = 5432

# Oracle TNS protocol port (None to disable Oracle protocol)
oracle_port = 1521

# Maximum concurrent connections
max_connections = 100

# Enable TLS/SSL
tls_enabled = false

# TLS certificate path (required if tls_enabled = true)
# tls_cert_path = "/path/to/cert.pem"

# TLS private key path (required if tls_enabled = true)
# tls_key_path = "/path/to/key.pem"

# ============================================================================
# PERFORMANCE CONFIGURATION
# ============================================================================
[performance]
# Number of worker threads (default: number of CPU cores)
# Set to 0 to use all available cores
worker_threads = 0

# Query timeout in seconds (legacy setting, use storage.query_timeout_ms instead)
query_timeout_secs = 300

# Enable SIMD optimizations for vector operations
simd_enabled = true

# Enable parallel query execution
parallel_query = true

# ============================================================================
# AUDIT CONFIGURATION
# ============================================================================
[audit]
# Enable audit logging
enabled = false

# Audit log file path
# log_path = "/var/log/heliosdb/audit.log"

# Events to audit (comma-separated):
# - "all": All events
# - "auth": Authentication events
# - "query": Query execution
# - "ddl": Schema changes (CREATE, ALTER, DROP)
# - "dml": Data modifications (INSERT, UPDATE, DELETE)
# log_events = ["auth", "ddl"]

# ============================================================================
# OPTIMIZER CONFIGURATION (v2.1)
# ============================================================================
[optimizer]
# Enable query optimizer
enabled = true

# Enable/disable specific scan and join methods
enable_seqscan = true
enable_indexscan = true
enable_hashjoin = true
enable_mergejoin = true
enable_nestloop = true

# Cost model parameters (PostgreSQL-compatible)
# Adjust these to tune optimizer behavior for your workload
seq_page_cost = 1.0          # Cost of sequential page fetch
random_page_cost = 4.0       # Cost of random page fetch (SSD: 1.1, HDD: 4.0)
cpu_tuple_cost = 0.01        # Cost of processing one tuple
cpu_index_tuple_cost = 0.005 # Cost of processing one index tuple

# ============================================================================
# AUTHENTICATION CONFIGURATION (v2.1)
# ============================================================================
[authentication]
# Enable authentication
enabled = false

# Authentication method:
# - "trust": No authentication (dev mode only!)
# - "password": Password-based authentication
# - "jwt": JWT token authentication
# - "ldap": LDAP authentication
method = "trust"

# JWT configuration (only used if method = "jwt")
# jwt_secret = "your-secret-key-here-change-in-production"
jwt_expiration_secs = 86400  # 24 hours

# Password hash algorithm:
# - "argon2": Argon2 (recommended, most secure)
# - "bcrypt": BCrypt (good balance)
# - "pbkdf2": PBKDF2 (widely supported)
password_hash_algorithm = "argon2"

# Users file path (for file-based authentication)
# users_file = "/etc/heliosdb/users.json"

# ============================================================================
# COMPRESSION CONFIGURATION (v2.1)
# ============================================================================
[compression]
# Default compression type for new tables
# Options: "None", "Zstd", "Lz4"
default_type = "Zstd"

# Compression level (1-22 for Zstd, higher = better ratio but slower)
# Recommended: 3 for balanced performance, 9+ for maximum compression
level = 3

# Enable ALP (Adaptive Lossless floating-Point) compression
# Specialized compression for numeric columns
enable_alp = true

# Enable FSST (Fast Static Symbol Table) compression
# Specialized compression for string columns
enable_fsst = true

# Minimum data size to trigger compression (bytes)
# Small data blocks aren't worth compressing
min_size_bytes = 1024

# ============================================================================
# MATERIALIZED VIEW CONFIGURATION (v2.1)
# ============================================================================
[materialized_views]
# Enable auto-refresh by default for new materialized views
auto_refresh_default = false

# Default maximum CPU percentage for refresh operations
# Prevents refresh from consuming all CPU resources
default_max_cpu_percent = 15

# Interval to check if views need refresh (seconds)
refresh_check_interval_secs = 60

# Maximum concurrent refresh operations
max_concurrent_refreshes = 2

# ============================================================================
# VECTOR INDEX CONFIGURATION (v2.1)
# ============================================================================
[vector]
# Default vector index type:
# - "flat": Brute force, exact search (small datasets)
# - "hnsw": HNSW approximate search (recommended, fast)
# - "ivf": Inverted file index (large datasets)
default_index_type = "hnsw"

# HNSW parameters
# ef_construction: Higher = better recall but slower build (default: 200)
hnsw_ef_construction = 200

# M: Number of connections per layer (default: 16)
# Higher M = better recall but more memory
hnsw_m = 16

# Enable Product Quantization (PQ) for vector compression
# Provides 8-16x compression with minimal accuracy loss
enable_pq = true

# PQ subvector count (default: 8)
# Must divide vector dimension evenly
pq_subvectors = 8

# PQ bits per subvector (default: 8, which gives 256 centroids)
pq_bits = 8

# ============================================================================
# EXAMPLE DEPLOYMENT CONFIGURATIONS
# ============================================================================

# --- Development Configuration ---
# Uncomment and modify for local development:
# [storage]
# memory_only = true
# wal_enabled = false
# [server]
# listen_addr = "127.0.0.1"
# [authentication]
# method = "trust"

# --- Production Configuration ---
# Uncomment and modify for production:
# [storage]
# wal_sync_mode = "group_commit"
# query_timeout_ms = 30000
# [server]
# listen_addr = "0.0.0.0"
# tls_enabled = true
# tls_cert_path = "/etc/heliosdb/ssl/cert.pem"
# tls_key_path = "/etc/heliosdb/ssl/key.pem"
# [authentication]
# enabled = true
# method = "jwt"
# jwt_secret = "CHANGE-THIS-SECRET-IN-PRODUCTION"
# [encryption]
# enabled = true
# [audit]
# enabled = true
# log_path = "/var/log/heliosdb/audit.log"

# --- High-Performance Configuration (SSD) ---
# Uncomment for SSD-optimized settings:
# [optimizer]
# random_page_cost = 1.1  # SSDs have low random access cost
# [performance]
# worker_threads = 0      # Use all cores
# [storage]
# cache_size = 2147483648 # 2GB cache

# ============================================================================
# AI/LLM CONFIGURATION
# ============================================================================
[ai]
# Enable AI features (schema inference, generation, chat)
enabled = true

[ai.llm]
# LLM provider: "openai", "anthropic", "ollama", "local", "none"
provider = "none"

# Model selection (provider-specific)
# OpenAI: "gpt-4-turbo", "gpt-4o", "gpt-3.5-turbo"
# Anthropic: "claude-3-opus", "claude-3-sonnet", "claude-3-haiku"
# Ollama: "llama3", "codellama", "mistral"
model = "gpt-4-turbo"

# API key environment variable (not the key itself!)
api_key_env = "OPENAI_API_KEY"

# Generation parameters
temperature = 0.7
top_p = 0.9
max_tokens = 2048

# Request configuration
timeout_seconds = 60
max_retries = 3

# Rate limiting
requests_per_minute = 60

[ai.embedding]
# Embedding provider (usually same as LLM provider)
provider = "openai"

# Embedding model
# OpenAI: "text-embedding-3-large", "text-embedding-3-small", "text-embedding-ada-002"
model = "text-embedding-3-small"

# Embedding dimensions (must match vector column sizes)
dimensions = 1536

# Batch processing
batch_size = 100

# API configuration
api_key_env = "OPENAI_API_KEY"
timeout_seconds = 30

# ============================================================================
# RAG (RETRIEVAL-AUGMENTED GENERATION) CONFIGURATION
# ============================================================================
[rag]
# Enable RAG features
enabled = true

# Document chunking strategy
chunk_size = 512
chunk_overlap = 100

# Chunking method: "fixed", "sentence", "paragraph", "semantic"
chunking_method = "sentence"

# Similarity threshold for retrieval (0.0 - 1.0)
similarity_threshold = 0.7

# Context window configuration
max_context_tokens = 4000
max_chunks_per_query = 10

# Store chunk embeddings automatically
auto_embed_chunks = true

# Reranking (requires compatible model)
enable_reranking = false
rerank_top_k = 20

# ============================================================================
# FULL-TEXT SEARCH CONFIGURATION
# ============================================================================
[search]
# Enable full-text search
enabled = true

# Tokenizer: "simple", "english", "standard"
tokenizer = "english"

# Term length limits
min_term_length = 2
max_term_length = 64

# Search features
phrase_search_enabled = true
proximity_search_enabled = true
fuzzy_search_enabled = true

# Fuzzy search configuration
fuzzy_max_edits = 2

# Result highlighting
enable_highlighting = true
highlight_tag_open = "<mark>"
highlight_tag_close = "</mark>"

# ============================================================================
# WASM CONFIGURATION
# ============================================================================
[wasm]
# Enable WebAssembly execution
enabled = false

# Security limits
memory_limit_mb = 128
timeout_seconds = 30
max_stack_depth = 1000

# Allowed WASM modules (empty = all allowed)
# allowed_modules = ["trusted_module.wasm"]

# ============================================================================
# MCP (MODEL CONTEXT PROTOCOL) CONFIGURATION
# ============================================================================
[mcp]
# Enable MCP server
enabled = false

# Server configuration
host = "127.0.0.1"
port = 3000

# Resource limits
resource_limit_mb = 100
timeout_seconds = 30

# Allowed hosts for connections
allowed_hosts = ["localhost", "127.0.0.1"]

# ============================================================================
# ADVANCED STORAGE TUNING
# ============================================================================
[storage.tuning]
# Write amplification target (RocksDB writes per logical write)
# Lower = faster writes, higher = better space efficiency
write_amplification_target = 10

# MVCC snapshot retention policy: "auto", "manual", "aggressive"
# auto: Keep snapshots based on usage patterns
# manual: Keep all snapshots until explicitly deleted
# aggressive: Minimize snapshot retention for space savings
snapshot_retention_policy = "auto"

# Maximum snapshot age in hours (for auto/aggressive policies)
snapshot_max_age_hours = 168  # 7 days

# Index building strategy
parallel_index_builds = true
max_concurrent_index_builds = 2

# Batch operation sizing
default_batch_size = 1000
max_batch_size = 10000

# Compaction settings
enable_auto_compaction = true
compaction_style = "level"  # "level", "universal", "fifo"

# Memory-mapped I/O
enable_mmap = true
mmap_size_mb = 256

# ============================================================================
# SESSION CONFIGURATION (v3.1.0 - Multi-User ACID)
# ============================================================================
[session]
# How long a session can be idle before timeout (seconds)
# Default: 3600 (1 hour)
timeout_secs = 3600

# Maximum sessions per user
# Default: 10
max_sessions_per_user = 10

# How often to clean up inactive sessions (seconds)
# Default: 300 (5 minutes)
cleanup_interval_secs = 300

# ============================================================================
# LOCK CONFIGURATION (v3.1.0 - Multi-User ACID)
# ============================================================================
[locks]
# How long to wait for a lock before timing out (milliseconds)
# Default: 30000 (30 seconds)
timeout_ms = 30000

# How often to check for deadlocks (milliseconds)
# Default: 100
deadlock_check_interval_ms = 100

# Maximum number of concurrent lock holders
# Default: 10000
max_lock_holders = 10000

# ============================================================================
# DUMP CONFIGURATION (v3.1.0 - Memory-to-Disk Persistence)
# ============================================================================
[dump]
# Enable automatic dumps on a schedule
# Default: false
auto_dump_enabled = false

# Cron schedule for automatic dumps (requires auto_dump_enabled = true)
# Format: "minute hour day month weekday" (standard 5-field cron)
# Examples:
#   "0 */6 * * *"  - Every 6 hours
#   "0 2 * * *"    - Daily at 2:00 AM
#   "0 0 * * 0"    - Weekly on Sunday at midnight
# Default: "" (empty, no schedule)
schedule = "0 */6 * * *"

# Compression algorithm for dumps
# Options: "zstd", "gzip", "none"
# Default: "zstd"
compression = "zstd"

# Maximum size of a single dump file before rolling (MB)
# Default: 10000 (10 GB)
max_dump_size_mb = 10000

# Number of old dumps to keep (0 = keep all)
# Default: 10
keep_dumps = 10

# Directory to store dumps (relative or absolute path)
# Default: ".dumps"
dump_dir = ".dumps"

# ============================================================================
# RESOURCE QUOTA CONFIGURATION (v3.1.0 - Multi-User ACID)
# ============================================================================
[resource_quotas]
# Memory limit per user (MB)
# Prevents any single user from consuming all available memory
# Default: 1024 (1 GB)
memory_limit_per_user_mb = 1024

# Maximum concurrent queries per user
# Prevents query storms from a single user
# Default: 100
max_concurrent_queries = 100

# Query execution timeout (seconds)
# Queries exceeding this duration will be automatically terminated
# Default: 300 (5 minutes)
query_timeout_secs = 300