HeliosDB Nano v3.3.0 Quick Start Guide
HeliosDB Nano v3.3.0 Quick Start Guide
Installation
# Build from sourcegit clone https://github.com/dimensigon/HDB-HeliosDB-Nanocd HeliosDB Nanocargo build --release
# The binary will be at ./target/release/heliosdb-nanoStarting HeliosDB Nano
Option 1: Interactive REPL (Single-User Development)
# In-memory database (data lost on exit)heliosdb-nano repl --memory
# Persistent databaseheliosdb-nano repl -d ./mydbOption 2: Server Mode (Multi-User/Production)
# Start server (foreground)heliosdb-nano start -d ./mydb --port 5432
# Start as daemon (background)heliosdb-nano start --daemon -d ./mydb --port 5432
# Check status / stop daemonheliosdb-nano statusheliosdb-nano stopConnecting to Server Mode
Once the server is running, connect using any PostgreSQL client:
# Using psqlpsql -h 127.0.0.1 -p 5432
# Using connection stringpsql postgresql://127.0.0.1:5432/heliosdbFirst Steps in REPL
-- Get helpheliosdb> \h
-- Create a tableheliosdb> CREATE TABLE users ( -> id SERIAL PRIMARY KEY, -> name TEXT NOT NULL, -> email TEXT UNIQUE -> );Query OK
-- Insert dataheliosdb> INSERT INTO users (name, email) -> VALUES ('Alice', 'alice@example.com'), -> ('Bob', 'bob@example.com');Query OK, 2 rows affected
-- Query dataheliosdb> SELECT * FROM users; id | name | email----+-------+------------------ 1 | Alice | alice@example.com 2 | Bob | bob@example.com(2 rows)
-- List tablesheliosdb> \dTables: users
-- Describe tableheliosdb> \d usersTable: users──────────────────────────────────────────────────Column Type Nullable Primary Key──────────────────────────────────────────────────id Integer NO YESname Text NOemail Text YESEssential REPL Commands
Basic Commands
\h Show help\d List all tables\d <table> Describe table schema\dt List tables with details\timing Toggle query timing\q Quitv2.0 Features
\branches List database branches\snapshots List time-travel snapshots\dmv List materialized views\compression Show compression statisticsv2.1 Features
\set Show all settings\config Show configuration\stats Show database statistics\optimize <t> Optimization recommendationsEssential SQL Commands
Settings Management
-- Show current settingsSHOW ALL;SHOW optimizer;
-- Set timeoutsSET statement_timeout = 30000; -- 30 seconds
-- Set memorySET work_mem = 16384; -- 16MB
-- Enable optimizerSET optimizer = on;Time-Travel Queries
-- Enable time-travelSET time_travel_enabled = on;
-- Query historical dataSELECT * FROM orders AS OF TIMESTAMP '2025-11-23 10:00:00' WHERE customer_id = 123;Database Branching
-- Create a branchCREATE DATABASE BRANCH dev FROM main AS OF NOW;
-- Work on branchUSE BRANCH dev;
-- Merge backMERGE DATABASE BRANCH dev INTO main;Materialized Views
-- Create materialized viewCREATE MATERIALIZED VIEW customer_stats AS SELECT customer_id, COUNT(*) as order_count, SUM(amount) as total_spent FROM orders GROUP BY customer_id WITH (auto_refresh = true, max_cpu_percent = 15);
-- Refresh manuallyREFRESH MATERIALIZED VIEW customer_stats;
-- Query materialized viewSELECT * FROM customer_stats;Vector Search
-- Create table with vector columnCREATE TABLE documents ( id SERIAL PRIMARY KEY, content TEXT, embedding VECTOR(384));
-- Create vector indexCREATE INDEX ON documents USING hnsw(embedding);
-- Similarity searchSELECT id, contentFROM documentsORDER BY embedding <-> '[0.1, 0.2, ...]'::vectorLIMIT 10;Compression
-- Set compression for tableALTER TABLE large_table SET COMPRESSION zstd;
-- Check compression stats\compression large_tableConfiguration File
Basic Configuration (config.toml)
# Storage[storage]path = "./heliosdb-data"wal_enabled = truetime_travel_enabled = truecache_size = 536870912 # 512MB
# Server[server]listen_addr = "127.0.0.1"port = 5432max_connections = 100
# Performance[performance]worker_threads = 0 # Auto-detectsimd_enabled = trueparallel_query = true
# Optimizer[optimizer]enabled = truerandom_page_cost = 4.0 # 1.1 for SSD
# Compression[compression]default_type = "Zstd"level = 3Start with Configuration
# Copy examplecp config.example.toml config.toml
# Edit configurationnano config.toml
# Start with configheliosdb-nano start --config config.tomlCommon Use Cases
Analytics Workload
-- Configure for analyticsSET work_mem = 131072; -- 128MBSET shared_buffers = 1048576; -- 1GBSET optimizer = on;SET enable_seqscan = on;
-- Run analytics querySELECT DATE_TRUNC('day', created_at) as date, COUNT(*) as order_count, SUM(amount) as total_amountFROM ordersGROUP BY dateORDER BY date DESC;OLTP Workload
-- Configure for OLTPSET work_mem = 4096; -- 4MBSET statement_timeout = 5000; -- 5 secondsSET enable_indexscan = on;
-- Transactional queriesBEGIN;INSERT INTO orders (customer_id, amount) VALUES (123, 99.99);UPDATE customers SET total_spent = total_spent + 99.99 WHERE id = 123;COMMIT;Data Warehouse
-- Create materialized views for aggregationsCREATE MATERIALIZED VIEW daily_sales AS SELECT DATE_TRUNC('day', created_at) as date, product_id, COUNT(*) as sales_count, SUM(amount) as revenue FROM orders GROUP BY date, product_id WITH (auto_refresh = true);
-- Query aggregated dataSELECT * FROM daily_salesWHERE date >= CURRENT_DATE - INTERVAL '30 days';Vector Similarity Search
-- Configure vector indexesSET vector_index_type = 'hnsw';SET hnsw_ef_construction = 200;
-- Create embeddings tableCREATE TABLE embeddings ( id SERIAL PRIMARY KEY, document_id INT, embedding VECTOR(384));
-- Create indexCREATE INDEX ON embeddings USING hnsw(embedding);
-- Similarity searchSELECT document_idFROM embeddingsORDER BY embedding <-> $1::vectorLIMIT 10;Performance Tips
-
Enable timing to identify slow queries:
\timing -
Use EXPLAIN to understand query plans:
EXPLAIN SELECT * FROM large_table WHERE id > 1000; -
Set appropriate timeouts:
SET statement_timeout = 30000; -- 30 seconds -
Tune memory for workload:
-- Analytics: more memorySET work_mem = 131072; -- 128MB-- OLTP: less memory, more concurrencySET work_mem = 4096; -- 4MB -
Use compression for large tables:
ALTER TABLE logs SET COMPRESSION zstd; -
Create materialized views for expensive queries:
CREATE MATERIALIZED VIEW expensive_query ASSELECT ... complex query ...WITH (auto_refresh = true);
Troubleshooting
Query too slow
-- Check query planEXPLAIN SELECT * FROM table WHERE condition;
-- Get index recommendations\indexes table_name
-- Increase work memorySET work_mem = 16384;
-- Enable timing\timingOut of memory
-- Reduce work_memSET work_mem = 2048;
-- Disable parallel executionSET parallel_query = off;
-- Check current settingsSHOW work_mem;SHOW shared_buffers;Connection issues
# Check server status\server status
# Check configuration\config
# Restart serverheliosdb-nano start --config config.tomlNext Steps
-
Read the documentation:
-
Explore features:
- Time-travel queries
- Database branching
- Materialized views
- Vector search
-
Optimize performance:
- Use EXPLAIN for query plans
- Create appropriate indexes
- Tune memory settings
- Enable compression
-
Set up production:
- Configure TLS/SSL
- Enable authentication
- Set up audit logging
- Configure backups
Resources
- Documentation:
/docs/ - Examples:
/examples/ - Configuration:
config.example.toml - Deployment Modes:
docs/guides/MODE_SELECTION_GUIDE.md - GitHub: https://github.com/dimensigon/HDB-HeliosDB-Nano
- Issues: https://github.com/dimensigon/HDB-HeliosDB-Nano/issues
Getting Help
-- In REPL\h General help\h <command> Command-specific help
-- Show settingsSHOW ALL;
-- Show configuration\config
-- Show statistics\statsQuick Reference Card
| Task | REPL | SQL | Config |
|---|---|---|---|
| List tables | \d | SELECT * FROM pg_tables | - |
| Set timeout | \set statement_timeout 30000 | SET statement_timeout = 30000; | [storage] query_timeout_ms = 30000 |
| Enable optimizer | \set optimizer on | SET optimizer = on; | [optimizer] enabled = true |
| Time-travel | \snapshots | AS OF TIMESTAMP '...' | [storage] time_travel_enabled = true |
| Compression | \compression | ALTER TABLE ... SET COMPRESSION | [compression] default_type = "Zstd" |
| View config | \config | SHOW ALL; | - |
| Get help | \h | - | - |
Welcome to HeliosDB Nano! Start exploring with \h in the REPL.