⚡ 377 Tests Passing • Pure Rust Kernel

Learned Machine Learning Indexes
Meet Vector & Relational SQL

ShrestiDB is an embedded database kernel that replaces bulky B-Trees with learned regression models and SIMD vector search — delivering 8x–10x faster lookups and a 4x smaller memory footprint in a single binary.

🧠

Learned PGM & RMI Indexing

Treats key indexing as an ML regression problem. Predicts exact tuple offsets with bounded linear segments, scaling flatly at O(log ε) while saving 75% RAM over B-Trees.

📐

Native SIMD Vector Engine

High-dimensional embeddings with Hierarchical Navigable Small World (HNSW) proximity graphs. Accelerated by AVX2/NEON SIMD cosine, L2, and dot product distances.

⚡

ACID MVCC & Learned Auto-GC

Snapshot-isolated transactions with row-level 2PL and write-ahead logging (WAL). Online regression models predict version bloat to sweep dead tuples without manual VACUUM.

Measured Benchmark Results

Reproducible with cargo run --release --example learned_index_demo

Dataset Scale Learned PGM Lookup Learned RMI Lookup Standard B+Tree PGM Speedup Index Memory Footprint
10,000 Keys 0.55 µs 0.18 µs 0.10 µs 0.5x ~4x smaller
100,000 Keys 0.41 µs 0.22 µs 0.30 µs 0.7x ~4.1x smaller
1,000,000 Keys 0.44 µs 0.37 µs 3.61 µs 8.2x – 9.8x FASTER 75% Less RAM (~4.2x)
Relational + Vector Similarity (SQL) SQL-92 + pgvector
-- Unified structured metadata + vector search
SELECT 
    a.name, 
    addr.city, 
    a.embedding <=> '[0.90, 0.15, 0.05]' AS distance
FROM accounts a
JOIN address addr ON a.id = addr.id
WHERE a.balance > 3000
ORDER BY distance
LIMIT 5;
Zero-Dependency Rust Embedded Engine main.rs
use shrestidb::execution::QueryExecutor;

fn main() -> anyhow::Result<()> {
    // Durable engine backed by Write-Ahead Log (WAL)
    let db = QueryExecutor::open("shrestidb.wal")?;

    // Execute SQL statements directly
    let rows = db.execute_sql(
        "SELECT * FROM accounts WHERE balance >= 5000;"
    )?;
    Ok(())
}