The SQL Database That
Ships With Your App
Pure Rust. Zero C dependencies. ACID transactions, cost-based optimizer, parallel execution, and 110+ built-in functions. Compiles to WebAssembly.
MVCC Transactions
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';
Cost-Based Optimizer
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)
Parallel Execution
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
Everything You Need
Enterprise-grade features in an embeddable package.
Multiple Index Types
B-tree, Hash, Bitmap indexes auto-selected by type. Multi-column composite indexes.
Semantic Query Caching
Predicate subsumption detects when cached results can answer stricter queries.
Window Functions
ROW_NUMBER, RANK, DENSE_RANK, LAG, LEAD, NTILE with PARTITION BY and frames.
Recursive CTEs
WITH RECURSIVE for hierarchical queries, graph traversal, and sequence generation.
WAL + Crash Recovery
Write-ahead logging with snapshots ensures durability. Automatic recovery on restart.
Full SQL Support
JOINs, subqueries, ROLLUP/CUBE/GROUPING SETS, UNION/INTERSECT/EXCEPT, and more.
Try It in Your Browser
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)
Get Started in Minutes
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")?; let conn = db.connect(); conn.execute("CREATE TABLE users ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, email TEXT UNIQUE )")?; conn.execute("INSERT INTO users VALUES (1, 'Alice', 'alice@example.com')")?; let mut result = conn.query("SELECT * FROM users")?; while result.next() { println!("{:?}", result.row()); } 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';
How Stoolap Compares
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 | ✓ | ✓ | ✓ | ✓ |
| Pure Rust (Memory Safe) | ✓ | ✗ | ✗ | ✗ |
| Embeddable (No Server) | ✓ | ✓ | ✓ | ✗ |
Modern Architecture
Designed for performance, scalability, and ease of use
Flexible Client Interface
CLI and Rust API. Embed directly in your application with zero external dependencies.
Optimized Query Processing
SQL parsing, cost-based optimization, and parallel execution for exceptional performance.
MVCC Storage Engine
Row-based version store with B-tree, Hash, and Bitmap indexes for transactional integrity.
Open Source
Licensed under Apache 2.0 with explicit patent grants.
Patent Protection
Explicit patent grant protects users and contributors
Community-Friendly
Promotes collaboration while protecting contributions
Enterprise-Ready
Widely accepted license for enterprise environments