Pure Rust. Zero C dependencies. ACID transactions, cost-based optimizer, parallel execution, vector search with HNSW indexes, and 117 built-in functions. Compiles to WebAssembly.
Full multi-version concurrency control with snapshot isolation. Readers never block writers. Optimistic concurrency delivers high throughput on mixed workloads with time-travel queries via AS OF.
-- Concurrent transactions BEGIN; UPDATE accounts SET balance = balance - 100 WHERE id = 1; UPDATE accounts SET balance = balance + 100 WHERE id = 2; COMMIT; -- Time-travel query SELECT * FROM accounts AS OF '2024-01-15 10:30:00';
PostgreSQL-style query planning with adaptive execution. The optimizer learns from actual cardinalities and re-optimizes at runtime. Bloom filter propagation, zone map pruning, and semantic query caching reduce redundant work.
Explore the optimizer →-- EXPLAIN shows the optimizer at work EXPLAIN ANALYZE SELECT u.name, SUM(o.amount) FROM users u JOIN orders o ON u.id = o.user_id WHERE o.amount > 50 GROUP BY u.name; -- Hash Join (cost=45.2, rows=1200) -- Seq Scan on orders (rows=8500) -- Hash on users (rows=1000)
Rayon work-stealing scheduler automatically parallelizes filters, joins, sorts, and distinct operations. Chunked processing with configurable thresholds keeps small queries fast while large queries scale across all cores.
See parallel execution →-- Automatic parallel execution SELECT category, AVG(price) FROM products WHERE price > 10 GROUP BY category; -- EXPLAIN ANALYZE output: -- Parallel Seq Scan (workers=8) -- actual rows=735,000 -- parallel speedup: 6.2x
Native VECTOR type with HNSW indexes for sub-linear approximate nearest neighbor search. Three distance metrics (L2, Cosine, Inner Product). Optional EMBED() function converts text to vectors using a built-in sentence-transformer model, no external APIs or Python needed.
-- Semantic search with HNSW index CREATE TABLE docs ( id INTEGER PRIMARY KEY, content TEXT, embedding VECTOR(384) ); CREATE INDEX idx_emb ON docs(embedding) USING HNSW WITH (metric = 'cosine'); SELECT content, VEC_DISTANCE_COSINE( embedding, EMBED('forgot password') ) AS dist FROM docs ORDER BY dist LIMIT 5;
Enterprise-grade features in an embeddable package.
Native VECTOR type with HNSW, B-tree, Hash, and Bitmap indexes. Optional built-in semantic search.
Predicate subsumption detects when cached results can answer stricter queries.
ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, NTILE with PARTITION BY and frames.
WITH RECURSIVE for hierarchical queries, graph traversal, and sequence generation.
Write-ahead logging with snapshots ensures durability. Automatic recovery on restart.
JOINs, subqueries, ROLLUP/CUBE/GROUPING SETS, UNION/INTERSECT/EXCEPT, and more.
Stoolap compiles to WebAssembly. Run real SQL queries right now, no installation, no server. Everything runs locally.
Open Stoolap Playgroundstoolap> WITH RECURSIVE fib(n, a, b) AS ( SELECT 1, 0, 1 UNION ALL SELECT n+1, b, a+b FROM fib WHERE n < 10 ) SELECT n, a AS fibonacci FROM fib; +----+-----------+ | n | fibonacci | +----+-----------+ | 1 | 0 | | 2 | 1 | | 3 | 1 | | 4 | 2 | | 5 | 3 | +----+-----------+ (10 rows, 0.1ms)
Embed Stoolap as a library or use the standalone CLI.
use stoolap::Database; fn main() -> Result<(), Box<dyn std::error::Error>> { let db = Database::open("my_database")?; db.execute("CREATE TABLE users ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, email TEXT UNIQUE )", ())?; db.execute("INSERT INTO users VALUES (1, 'Alice', 'alice@example.com')", ())?; for row in db.query("SELECT * FROM users", ())? { let row = row?; let name: String = row.get(1)?; println!("{name}"); } Ok(()) }
-- Window functions with CTEs WITH ranked AS ( SELECT customer_id, amount, ROW_NUMBER() OVER ( PARTITION BY customer_id ORDER BY amount DESC ) AS rn FROM orders WHERE amount > 1000 ) SELECT * FROM ranked WHERE rn = 1; -- Time-travel queries (unique to Stoolap) SELECT * FROM users AS OF '2024-01-15 10:30:00';
Feature-by-feature comparison with popular databases
| Feature | Stoolap | SQLite | DuckDB | PostgreSQL |
|---|---|---|---|---|
| MVCC Transactions | ✓ | ✗ | ✓ | ✓ |
| AS OF Temporal Queries | ✓ | ✗ | ✗ | ✗ |
| Cost-Based Optimizer | ✓ | ✗ | ✓ | ✓ |
| Adaptive Query Execution | ✓ | ✗ | ✗ | ✗ |
| Semantic Query Caching | ✓ | ✗ | ✗ | ✗ |
| Parallel Query Execution | ✓ | ✗ | ✓ | ✓ |
| Hash / Merge Joins | ✓ | ✗ | ✓ | ✓ |
| Window Functions | ✓ | ✓ | ✓ | ✓ |
| ROLLUP / CUBE / GROUPING SETS | ✓ | ✗ | ✓ | ✓ |
| Recursive CTEs | ✓ | ✓ | ✓ | ✓ |
| Native Vector / HNSW Search | ✓ | ✗ | ✗ | ✗ |
| Pure Rust (Memory Safe) | ✓ | ✗ | ✗ | ✗ |
| Embeddable (No Server) | ✓ | ✓ | ✓ | ✗ |
Designed for performance, scalability, and ease of use
CLI and Rust API. Embed directly in your application with zero external dependencies.
SQL parsing, cost-based optimization, and parallel execution for exceptional performance.
Row-based version store with B-tree, Hash, Bitmap, and HNSW indexes for transactional integrity and vector search.
Licensed under Apache 2.0 with explicit patent grants.
Explicit patent grant protects users and contributors
Promotes collaboration while protecting contributions
Widely accepted license for enterprise environments