A commerce workload for Owl, checked and timed against SQLite.
It exists to answer two questions with evidence: does Owl return the right answers to realistic queries, and how fast is it compared with a mature embedded engine given the same data, the same indexes and the same durability?
| File | Purpose |
|---|---|
schema.oql |
The data model in OQL: seven collections, typed line items inside orders, constraints and indexes declared with the schema |
schema.sql |
The same model for SQLite. Every reference Owl indexes automatically has an explicit index here |
queries/*.oql, queries/*.sql |
Sixteen queries, each written in both languages |
src/data.rs |
A deterministic generator: the same order count always yields the same data |
src/engines.rs |
Loading and querying for each engine, and the result comparison |
cargo run --release -p storefront -- check --orders 2000loads both engines with identical data and requires all sixteen queries to return the same rows. Numbers match within a relative tolerance of one part in a million, because the engines add floats in different orders.
cargo run --release -p storefront -- bench --orders 10000,100000 --samples 3times loading and each query. Each query runs once untimed, then --samples
times; the median is reported. --output report.json saves everything.
cargo run --release -p storefront -- time --orders 10000 'orders.count()'times ad-hoc OQL against a loaded dataset.
- Data. One generator feeds both engines.
- Durability. Owl syncs each batch before returning. SQLite runs in WAL
mode with
synchronous=FULLand one transaction per batch of the same 500 rows. - Indexes. The same secondary indexes on both sides, and an index for every relationship.
- Statistics. SQLite runs
ANALYZEafter loading. - Result handling. Both sides convert every row to JSON inside the timed region.
- Loading. Both sides are handed values, not text: SQLite through
prepared statements, Owl through
QueryExecutor::insert_documents, which applies the same typing, defaults, checks and constraints ascollection.insert [ .. ]and commits each batch with one durable write.
Run on 2026-11-15 on an 8-core Apple Silicon machine with 8 GB of memory, at 100,000 orders (247,048 rows in total). Times are medians of seven runs, in milliseconds. The machine was busy during this run, so both engines are about half again slower than in a quiet one and figures move by tens of percent between runs: read the ratios, and treat one near 1 as a tie.
| Query | Owl | SQLite | Owl ÷ SQLite |
|---|---|---|---|
| q01 one order with customer and items | 0.06 | 0.03 | 1.8× |
| q02 twenty most recent paid orders | 0.20 | 0.04 | 4.9× |
| q03 large orders from one country | 21.95 | 19.46 | 1.1× |
| q04 customers by lifetime spend | 188.43 | 267.82 | 0.7× |
| q05 three latest orders per gold customer | 1.69 | 1.64 | 1.0× |
| q06 orders and revenue by status | 80.33 | 135.71 | 0.6× |
| q07 paid revenue by month | 138.28 | 75.70 | 1.8× |
| q08 paid revenue by customer country | 118.18 | 189.42 | 0.6× |
| q09 best-selling products from line items | 1332.31 | 1530.72 | 0.9× |
| q10 paid customers with no ticket | 44.70 | 9.25 | 4.8× |
| q11 orders above their customer's average | 1489.55 | 1541.11 | 1.0× |
| q12 category tree with statistics | 0.83 | 0.74 | 1.1× |
| q13 customers per country | 9.03 | 3.27 | 2.8× |
| q14 countries buying in one month | 74.16 | 32.72 | 2.3× |
| q15 payments by method in a quarter | 52.84 | 17.29 | 3.1× |
| q16 best-reviewed products | 50.72 | 49.71 | 1.0× |
Loading took 24 s for Owl (10,165 rows/s, 122 MiB on disk) and 22 s for SQLite (11,366 rows/s, 56 MiB) in this run; on a quiet machine both take 10 to 15 s.
Owl is level with or ahead of SQLite on nine queries, within about three times on five, and near five times behind on two (q02 and q10). All sixteen return the same rows as SQLite. Three of the queries that were four to six times behind are now level: q03 (was 4.1×), q05 (6.3×) and q12 (5.7×).
cargo run --release -p storefront -- memory --orders 100000reports Owl's memory alone (its physical footprint) at each stage. A row
with a list, an object or a vector in it lives outside the column segments,
and by default stays decoded in memory for as long as the database is open.
A budget on decoded documents (RustStore::with_decoded_budget,
owl-server --decoded-documents, or the OWL_DECODED_DOCUMENTS environment
variable) bounds what is held:
- only that many rows are held decoded; the rest are decoded when read, and a scan decodes only the fields it filters on or returns;
- a row's encoded record is read back from the checkpoint files once they hold it, instead of being kept in memory;
- a writer that outruns the background checkpoints waits for them, so what has been written but not yet checkpointed stays near 16 MiB of log.
Every answer is the same: the test suites pass with a budget of zero, and so does the check against SQLite.
Measured on 2026-11-15 at 100,000 orders (247,048 rows, 137 MiB on disk):
| Budget | Loaded | Checkpointed | Compacted | Reopened |
|---|---|---|---|---|
| None | 915 MiB | 653 MiB | 545 MiB | 288 MiB |
| 20,000 documents | 227 MiB | 163 MiB | 167 MiB | 83 MiB |
| 0 documents | 186 MiB | 126 MiB | 125 MiB | 78 MiB |
"Loaded" still includes the 55 MiB of generated data the benchmark holds while it loads. Before this work the same table read 941, 600, 502 and 404 MiB with no budget; 624, 322, 255 and 360 with 20,000 documents; and 654, 283, 219 and 281 with none.
At 250,000 orders (617,329 rows, 336 MiB on disk) with a budget of 20,000 documents: 436 MiB loaded (148 MiB of it generated data), about 300 MiB settled, 190 MiB reopened. That is roughly 0.5 KB a row, and it grows in line with the data. By that measure a million orders would load in about 1.2 GB and reopen in under 1 GB. It has not been run: this machine had 3 GiB of disk free, which the database and its checkpoint files would fill.
What the budget costs is speed on reads that go beyond the rows held decoded. With a budget of zero every row read is decoded from its record, and a record outside the segments is read from the file: at 100,000 orders q12 goes from 0.5 ms to 30 ms and the large scans are five to ten times slower, while loading takes 20 s instead of 16 s. A budget sized to the rows an application touches often avoids most of that.
What is still held in memory with nothing decoded, in a reopened database: the directory of ids for rows outside the segments, the index of what refers to what (one entry per referenced document and field), and the directory of the checkpoint's records.
Most queries run on the general executor, which represents a row as a map of field names to values and builds one for every row it reads. That is what the first benchmark measured, and what the work since has been removing.
- Aggregating without building rows. A query that filters and then
counts, aggregates, or groups is folded straight from storage: each row is
visited once and none is kept. Storage evaluates the filters it can. The
rest (a filter through a reference, a computed group key such as
format_date(.placed, "%Y-%m"), a key reached through a reference such as.customer.country, an aggregate of an expression, an aggregate over part of a group, ahaving) is evaluated by the same evaluator the general path uses, against the stored document. A value reached through a reference is looked up once per distinct reference. This is q06, q07, q08, q13, q15 and q16. - Shaping rows as they are read.
where { .. }.select { .. }builds each result row from the stored document, with no intermediate row. - One pass for a question asked of every row. When many rows of one
statement ask the same thing of their related rows (
.orders.count(),.orders.where { .. }.sum(.total),.tickets.exists()), Owl reads the referring collection once and answers each row from the tally. The first 64 rows still use the index, so a query about a few rows does not pay for a scan. This is q04 and q10. - Starting from the smaller side. A leading filter on a field of a
referenced document (
.customer.country == "NG") starts from the documents that pass and follows the relationship back. This is q03. - Using the order an index gives. A sort with a tie-breaker takes its
first page in index order and re-sorts only the rows tied at the page
boundary (q02), and timestamp text compared with a
DateTimefield is typed when the query is planned, so the index applies (q14, q15).
Each of these returns None when a query does not fit and leaves it to the
general executor, which defines what every query means. The conformance
suite runs each shape both ways and requires identical rows.
What is still behind, and why:
- q10 counts from
index(.status, .customer)without reading an order, as SQLite does. What remains is evaluating two conditions for each of 10,000 customers through the general evaluator. - q02 is a 0.2 ms query. What remains is fixed work: parsing and planning it, and shaping twenty rows.
- q13, q14 and q15 are two to three times behind. They fold or filter tens of thousands of rows through the general evaluator, where SQLite runs compiled loops over an index.
Measured at 10,000 orders unless noted.
| Change | Effect |
|---|---|
A filter on id is a lookup, not a scan |
q01: 58 ms to 0.05 ms |
| A group's rows are shared by its aggregates instead of copied per aggregate | q06: 240 ms to 31 ms |
| A scan decodes only the fields the query reads | q13: 20 ms to 3.5 ms |
| A batch of scattered records is read in nearby runs, not one span from first to last | q02 at 100,000 orders: 3.9 s to 0.48 s; q04: 10.3 s to 1.2 s |
| A sort with a tie-breaker takes its first page from the index | q02: 52 ms to 0.6 ms; at 100,000 orders 483 ms to 1.2 ms |
| A timestamp filter uses the field's index | q14: 27 ms to 4 ms; q15: 24 ms to 0.8 ms |
| Simple aggregates and groupings read column batches without building rows | q06: 31 ms to 5 ms |
| A referenced document is fetched once per statement | q08: 44 ms to 31 ms |
| Rows reached through a relationship are shared and trimmed to the fields read | q04: 105 ms to 62 ms; q10: 62 ms to 40 ms |
| A filter on a referenced document's field starts from that document | q03 at 100,000 orders: 403 ms to 112 ms |
| Per-row counts and existence tests over a relationship are answered from one pass | q10 at 100,000 orders: 566 ms to 219 ms |
Grouping and aggregating fold storage directly for computed keys, keys through a reference, filtered aggregates and having |
At 100,000 orders: q07 398 ms to 130 ms; q08 419 ms to 100 ms; q13 82 ms to 9 ms; q16 328 ms to 58 ms |
| A scan reads rows in the id order they are already kept in, instead of copying and sorting every id | q06 at 100,000 orders: 104 ms to 58 ms |
| A per-row aggregate over a relationship is answered from one pass | q04 at 100,000 orders: 706 ms to 298 ms |
| Reading a field no longer times itself: a built-in profiler took two clock readings and a process-wide lock on every field read, and is now off unless asked for | At 30,000 orders, with the two changes below: q03 77 ms to 20 ms |
| A lookup by id searches the ordered directory by borrowed text instead of building a key from two new strings | (with the above) |
| Rows reached through a relationship are filtered before they are copied, and name themselves without copying | q12 at 100,000 orders: 9.4 ms to 4.3 ms; q05: 9.7 ms to 7.0 ms |
| A relationship tally accumulates per referenced document directly, building no group rows | q10 at 100,000 orders: 142 ms to 93 ms; q04: 298 ms to 200 ms |
| A relationship count whose filters are equalities is answered from an index on those fields and the reference, reading no row; the index was added to both engines | q10 at 100,000 orders: 93 ms to 28 ms (SQLite: 18 ms to 6 ms) |
| A unique index is consulted for a new key, instead of reading every document in the database | Loading 100,000 orders: 42 s to 18 s |
A reference is checked by looking its target up rather than copying it, a check constraint is parsed once, and loading hands Owl values through a prepared insert |
Loading 100,000 orders: 18 s to 16 s |
| The first rows in order of id are read in that order and the read stops at the limit, instead of filtering every row and sorting | q05 at 100,000 orders: 8.0 ms to 1.2 ms |
| A count or aggregate over one document's related rows reads them where they lie, through one relationship or several, without copying them into a collection | q12 at 100,000 orders: 2.7 ms to 0.5 ms |
sort { .. }.limit(n) finds the best n rows without sorting the rest, and through a reference chooses them before copying any |
q03 at 100,000 orders: 67 ms to 20 ms (with the two rows below) |
| An index finds a key's page, and the key within it, by bisection instead of looking at every page and entry; a range of an index is walked in place without copying keys | (q03, and every index lookup) |
| A sort with a tie-breaker asks for one row past the page, and looks the ties up only when that row ties | q02 at 100,000 orders: 0.15 ms to 0.12 ms |
| Each key of an in-memory index holds its objects in place, not in a tree of its own | 112 bytes a key; 50 MiB of the load peak at 100,000 orders |
| With a memory budget, records are read back from the checkpoint files, a writer waits for overdue checkpoints, and reopening decodes nothing beyond the budget | Load peak at 100,000 orders with a 20,000-document budget: 624 MiB to 227 MiB |
| Declaring a schema again exactly as it stands writes nothing; before, every start of an application rebuilt each index in memory beside the checkpointed one | Reopened database at 100,000 orders: 404 MiB to 288 MiB without a budget, 360 MiB to 83 MiB with one |
A selected field a row has no value for is null in rows read through an index, as it already was in rows read by a scan |
Same answer whether or not an index is used |
Loading 100,000 orders took 98 s in the first benchmark.
The fourth of these was a quadratic cost in the storage engine: every batch of index-ordered lookups read nearly the whole segment.