Hybrid indexing
HOT, Bitmap, PGM, FM, HNSW, PMA, Sparse/SPLADE, and MinHash indexes all resolve through the same RowId space, making mixed predicates practical inside one engine.
A local database for writes, scans, search, vectors, ranges, and encrypted storage.
MongrelDB is an open source embedded database for applications that need more than key-value lookup, but do not want to operate a separate service for every access pattern. Store data locally, query it with SQL or native APIs, and combine equality, range, text, vector, and sparse retrieval in one engine.
Embedded databases are strongest when they stay close to the application. MongrelDB keeps that deployment model while adding the access paths modern software often has to bolt on later.
HOT, Bitmap, PGM, FM, HNSW, PMA, Sparse/SPLADE, and MinHash indexes all resolve through the same RowId space, making mixed predicates practical inside one engine.
Fast scans should not require giving up direct writes. MongrelDB uses a WAL and memtable in front of immutable PAX-columnar .sr runs.
ENCRYPTED_INDEXABLE columns use equality and range tokens to narrow candidate rows before plaintext is required.
Use SQL through DataFusion, Arrow IPC for batches, and NAPI bindings for Node. Keep local data local until your application needs to move it.
Each index returns RowIds, so the engine can combine filters without forcing every workload through a single data structure.
Height-optimized trie access keeps primary-key lookup compact and direct, then returns RowIds that can be combined with other predicates.
Low-cardinality values compress into Roaring bitmaps, turning equality filters into set operations instead of table walks.
A shrinking-cone, epsilon-bounded learned model predicts where range keys live, then resolves qualifying rows into RowIds.
BWT plus wavelet-tree substring search lets containment queries use an index instead of falling back to a full scan.
Semantic similarity search lives beside text, equality, and range filters instead of requiring a separate vector database.
Packed memory arrays support mutable sorted structures without tuning for a specific cache size.
Learned sparse retrieval brings inverted-token scoring into the same engine as dense vectors, substring search, and ordinary filters.
MinHash supports approximate set similarity for deduplication and join-style retrieval, then returns RowIds like the other access paths.
A vector match, substring filter, tenant predicate, and time range can all be represented as candidate RowId sets. MongrelDB intersects those sets first, then decodes the rows that remain.
The write path is log-structured. The read path resolves predicates to shared RowIds, decodes only the columns needed for the result, and keeps frequently requested answers close by.
Durability starts with an append-only write-ahead log that can batch fsync work.
A composite-key MVCC skip-list memtable absorbs updates before data is flushed into immutable runs.
Sorted-run pages support scans, compression, and projection pushdown in the embedded storage layer.
Equality, range, substring, vector, and sparse matches can be intersected before row decoding.
SQL, Arrow IPC, and Node-native bindings provide familiar ways to work with local data.
MongrelDB keeps durable writes in front of compressed runs, so applications can support updates and analytical reads in the same local store.
Memory-mapped runs, adaptive encodings, projection pushdown, page pruning, and a warm result cache keep read paths inside the embedded engine.
MongrelDB is designed to protect stored pages, authenticate metadata, and still let trusted predicates narrow work without decrypting the entire dataset first.
Page-level AES-256-GCM protects sorted-run payloads, WAL segments, result cache entries, and index checkpoints. Run metadata is authenticated so tampering can be detected on open.
Encrypted-indexable columns expose query tokens so equality and range predicates can resolve candidate rows without requiring a full decrypt-first scan.
Run metadata is authenticated, while encrypted page payloads are individually protected with AES-GCM tags.
Delta, Dictionary, Zstd, and passthrough encodings can be selected per column, while memory-mapped runs and a metadata count path keep the embedded profile lean.
Use SQL when it is enough, native calls when query shape matters, and Arrow when columnar data needs to move efficiently.
MongrelDB fits local-first apps, edge jobs, desktop tools, test harnesses, agent workflows, and Node services that benefit from embedded storage without a database server to operate.
// Open one local database. Combine multiple access paths.
const db = openMongrel("./app-data");
const hits = await db.hybridQuery({
ann: { column: "embedding", k: 50, vector: query },
contains: { column: "body", text: "needle" },
eq: { column: "tenant", value: "acme" },
range: { column: "created_at", between: [from, to] },
return: ["rowid", "title", "score"]
});
console.log(hits.length);
Explore the code, run the benchmarks, and try it against a workload that needs local writes, hybrid search, and analytical scans in one embedded database.