Execution cores and access methods
FluxDB presents one uniform data-access surface and resolves it onto the right execution core underneath. This page is what those cores are, how they are tuned, and what sits on top of them.
Two execution cores, by workload class
| Core | Used for | Shape on disk |
|---|---|---|
| SQLite | Transactional, low-latency row operations | One .db file per shard, in WAL mode |
| DuckDB | Analytical, columnar scans and aggregations | One .duckdb file per shard |
The split is by workload class, not by product. A query is routed to the transactional or the analytical engine based on what it is, so an application does not choose an engine and then live with that choice.
How SQLite is tuned
The defaults are not SQLite's defaults. They are tuned for a multi-process cell, and each choice is deliberate:
| Setting | Why |
|---|---|
| WAL journal mode | Readers do not block the writer and the writer does not block readers, which is the concurrency posture a multi-process cell needs |
NORMAL synchronous | The durability-throughput point that pairs with WAL for this workload |
| A derived cache size | Sized from the environment rather than left at a fixed default |
mmap | SQLite reads straight from the page cache, without a syscall and a copy into user space. This is a direct latency reduction on the read path |
| A journal size limit | A cap on WAL growth. Without it a write burst grows the WAL and never returns the space, which is a real defect this setting exists to close |
Each shard gets its own connection pool with read and write lane separation, matched to the storage engine's concurrency model, plus resource governance, so one workload cannot starve another for connections.
How DuckDB is used
DuckDB is the analytical core, and it carries one property worth calling out specifically.
The same connection reads native storage or remote lakehouse tables. The analytical engine holds lakehouse bridge methods, so a single connection per shard can be pointed at native DuckDB storage or at remote Parquet with Delta or Iceberg metadata, through the corresponding scan extensions.
There is no separate reader engine. That matters because a second engine for "external tables" is how a platform ends up with two query planners, two security paths and two sets of behavior for the same SQL. Here an external table is a table.
A catalog bridge converts Delta and Iceberg metadata into entries the analytical engine can attach directly, which is what makes reading tables in place a normal operation rather than an import.
The data access layer
Above the cores sits one resilient data access layer, and every service in the platform persists through it. That uniformity is what makes lifecycle, audit and replication behave consistently across the estate rather than per-subsystem.
It provides:
- Fetch, execute, batch execute and streaming iteration with chunking, so a large result does not have to be materialized whole.
- A fluent query builder.
- Transactions with automatic rollback, resting on a pinned-connection invariant so a transaction is genuinely one connection's worth of work.
- Connection pooling with read and write lanes, idle eviction, checkout timeouts, validation on checkout, and pool metrics.
- A connection budget, so pools are bounded rather than growing under pressure.
- Per-database write locking and project-root-relative path canonicalization, so paths are deterministic and an in-memory database never accidentally becomes a file.
- Workspace database resolution and ownership, which resolves which physical database a logical workspace database maps to. This is what makes workspace scoping enforced beneath the query rather than above it.
- A statement interceptor and a function registry, the hooks governance and user-defined functions bind into.
- Planner statistics, feeding the cost-based decisions above.
The multi-model access methods
The same substrate presents several data models, each with a real backend rather than a convention over tables, and each reached through its own access method.
| Model | What it offers | Reached through |
|---|---|---|
| Relational | Tables, views and materialized views | SQL over the PostgreSQL wire, Arrow Flight SQL, GraphQL |
| Analytical | Columnar scans and aggregations over the same assets | SQL, routed by workload class |
| Document | Collections with filters, sort, skip, limit, distinct and bulk operations | The document API |
| Property graph | Labeled vertices and typed edges with properties, neighbors and traversal | GQL / openCypher, Gremlin |
| Vector | Upsert, batch upsert and similarity search | The vector API, and vector SQL functions |
| Time series | Path registration, single and batch ingestion, range and latest queries, aggregation, and pre-computed rollups | The time-series API, PromQL |
Alongside them, Structures is a distinct engine rather than an access method over the same cores: 34 structure types over a native Redis-compatible wire, part of the same data service.
Why one substrate matters more than the model count
Any platform can list data models. The consequence here is different, and it is the reason to run them together:
A document, a graph edge, a vector and a time series all carry the same workspace scope, the same classification, the same lineage record and the same cost attribution as a row in a table, because they are the same substrate under one access layer. There is no second governance path for the non-relational half of your data, and no second product to license, secure and reconcile.
The alternative, which is what most estates actually have, is a relational database plus a document store plus a graph database plus a vector database, each with its own authentication, its own access model and its own audit story, and four seams between them.
Inside the document, graph and vector engines
The table above says what each model offers. This is how three of them are built, what their indexes are, and where their cost lives. Time series has its own page; search has its own page.
Document
A document collection is a SQLite table using the JSON1 extension. Each row
is an id, a doc holding the JSON, a _version counter, and created and
updated timestamps. So a collection is not a second storage engine beside the
relational core; it is the transactional core holding JSON.
Indexing. A collection declares JSON paths to index, and each becomes a
SQLite expression index over json_extract(doc, '$.path'). A filter on an
indexed path is an index seek; a filter on an unindexed path is a scan of the
collection, the same tradeoff a relational table makes. A collection can also
attach a SQLite FTS5 virtual table for full-text matching within that
collection, distinct from the standalone search engine.
Concurrency. The _version counter is the optimistic-concurrency control.
A version-checked partial update reads the version, applies the change, and
bumps the counter only if the row still holds the version it read, so a
concurrent read-modify-write is detected rather than silently lost.
Scaling. Documents map to cells through a consistent hash ring: the
(collection, document id) pair hashes to a position, and each cell holds many
virtual-node positions on the ring (128 per cell by default) so the key space
divides evenly. Adding or removing a cell moves only the keys between adjacent
positions rather than reshuffling the whole collection. Each document therefore
has one owning cell.
Property graph
The graph is stored in FluxDB-managed tables: graph_vertices,
graph_edges and graph_vertex_labels, with properties as JSON and a
soft-delete flag, all scoped by database. Writes are validated against the bound
ontology before they land.
Indexing. Vertex properties are indexed with SQLite expression indexes over
the JSON property path, one per (label, property), so a lookup by an indexed
property is a seek rather than a label scan.
Traversal scaling. Traversal is index-backed adjacency: the executor walks neighbors through the edge tables, and an LRU adjacency cache (64 MB by default, keyed by vertex, direction and edge type) keeps hot neighborhoods in memory so a repeated or multi-hop walk does not re-query SQLite for the same adjacency. Traversal cost grows with the neighborhood actually visited, the edges followed across the hops, not with the size of the graph. A cold deep traversal still reads from storage; the cache earns its keep on repeated and overlapping walks.
A single query is bounded by three guardrails so an unselective pattern cannot run away: a vertex-scan ceiling (10,000 by default), a wall-clock timeout (30 seconds by default) that raises rather than runs forever, and an intermediate-binding ceiling (one million rows by default).
Across shards, a vertex whose edges reach a vertex on another shard is represented locally by a ghost vertex, a placeholder row carrying the id, label and home shard of the real vertex. Edge connectivity survives the shard boundary without copying vertex state, and the authoritative vertex is fetched from its home shard when the traversal needs its properties. A traversal that crosses shards pays a remote fetch at each boundary crossing.
Vector
A vector space holds embeddings of a fixed dimension (384 by default) under a distance metric (cosine by default, with L2 and dot product also supported). The dimension is fixed per space: a vector whose length does not match is skipped rather than indexed.
The index type is verified in code, not assumed:
| Index | What it is | When it is used |
|---|---|---|
| HNSW | Hierarchical Navigable Small World, an in-memory graph index with approximate O(log n) search | The default for every space |
| IVF-PQ | Inverted file plus product quantization, a compressed index for large corpora | Selected per space by index_type |
| Flat scan | Exact brute-force comparison against every stored vector | Fallback until an index is ready, or on a dimension mismatch |
HNSW is the default. It builds a navigable multi-layer graph with 16 connections per node (32 at the base layer), a build beam width of 200, and a query beam width of 100. Neighbor selection uses the HNSW paper's heuristic so cross-cluster links are kept, which is what keeps search reaching the right neighborhood on clustered data rather than getting trapped in one cluster. Builds are deterministic: the same vectors in the same order produce the same graph, which matters for reproducibility across cells.
The recall and latency tradeoff is the query beam width. A larger beam
(ef_search) explores more of the graph, lifting recall toward the exact answer
at the cost of time; a smaller beam is faster and less exhaustive. A
metadata-filtered search automatically widens the beam to make up for candidates
the filter removes. HNSW is approximate by design, trading exactness for
sub-linear query time; the flat fallback is exact and linear.
IVF-PQ is the alternative for large, compressed indexes. It splits the space into coarse partitions (32 by default, probing 8 per query) and stores each vector as product-quantized codes (256 codewords per sub-quantizer, with the sub-quantizer count chosen as the largest value that divides the dimension). Unlike HNSW it cannot index from the first vector: its partitions and codebooks are learned from an accumulated sample, so a space stays on exact flat scan until it has enough vectors to train, then trains once and populates itself. Because quantized distances are lossy, the index is used as a coarse filter and its candidates are rescored exactly against the stored vectors, which keeps scores identical to flat scan and lifts recall above what the compressed codes alone would give.
Scaling. Each shard holds its own vector manager with a write-ahead log and periodic snapshot. A multi-shard search fans out in parallel, merges the top-k across shards, and tolerates a failed shard by skipping it rather than failing the search. A delete writes a WAL-durable tombstone under a stable id, so replaying the log after a restart does not resurrect a deleted vector.
Honest limits. HNSW lives in memory; durability is the write-ahead log plus the snapshot, so size the resident set for the vectors you keep searchable. IVF-PQ is built for large corpora, but the platform does not publish a measured large-scale benchmark, so treat its scale ceiling as a design target rather than a quoted figure.
Related
- Scale-out and elasticity, how these cores spread across shards and cells.
- Storage and performance, where the files actually live.
- Structures, the distinct structure engine.
- Engines and access methods, the platform-wide view including object, lakehouse and messaging.