General-purpose OLAP engines (DuckDB, Umbra, HyPer) still pay a “generality tax”: runtime schema
interpretation, generic tuple layouts and one-size-fits-all data structures. Bespoke OLAP
is a fully autonomous LLM-driven pipeline that generates a brand-new, workload-specific
C++ analytical engine from scratch, given only (a) a set of SQL query templates and (b) the underlying
Parquet dataset. Each engine is produced in minutes to a few hours for
a few hundred dollars of API cost, and delivers
order-of-magnitude speedups over the best available general-purpose systems.
Headline Results
11.17×
vs DuckDB on TPC-H (SF20, 1-thread)
7.24×
vs Umbra on TPC-H (SF20, 1-thread)
45.33×
vs DuckDB on CEB (SF2, 1-thread)
9.56×
vs Umbra on CEB (SF2, 1-thread)
7.65× / 6.12×
TPC-H, 16 threads (DuckDB / Umbra)
23.97× / 1.87×
CEB, 16 threads (DuckDB / Umbra)
Total workload runtime (single-threaded)
DuckDB — TPC-H
49.2 s
Umbra — TPC-H
31.9 s
Bespoke — TPC-H
4.4 s
DuckDB — CEB
19.5 s
Umbra — CEB
4.1 s
Bespoke — CEB
0.4 s
Per-query speedups range from 2.83×–102× on TPC-H and 11.6×–1500× on CEB;
Bespoke wins on every TPC-H query and loses on only two CEB queries versus Umbra (0.60× and 0.94×).
1 Why the Paper Matters
It is folk wisdom in the database community that “one size does not fit all” (Stonebraker & Çetintemel, 2005),
yet even modern columnar engines like DuckDB and HyPer still support any schema and any valid SQL.
That flexibility is not free: schemas are interpreted at runtime, tuple layouts stay generic, and operators
are chosen for hypothetical rather than actual access patterns. Historically, building a workload-specific engine
by hand cost the same as writing a new DBMS, so bespoke engines existed only for rare, high-value cases
(e.g. TigerBeetle).
The paper’s central claim is that LLM-driven code synthesis has finally made bespoke engines economically
viable — but only if the LLM is wrapped in a carefully engineered synthesis pipeline. Naive prompting fails
because a DBMS is a system of deeply inter-dependent components (storage ↔ operators ↔ execution strategy), so
uncoordinated edits either fail to compile, break correctness, or regress performance.
2 The Bespoke OLAP Pipeline
The system takes a DBMS contract — {query templates + parameter ranges, Parquet dataset} — and produces
a stand-alone C++ engine tailored to that contract. Synthesis proceeds in strict stages, and correctness is
never traded for performance.
STAGE 1Storage-layout planning (no exec code)
➜
STAGE 2Basic functional engine validated vs DuckDB
➜
STAGE 3Cardinality-informed opt.
➜
STAGE 4Self-tracing / profiling
➜
STAGE 5Expert-knowledge injection
➜
STAGE 6Human-engineer persona
➜
STAGE 7Multi-threading
Key design decisions
Storage is planned once, then frozen. Any later change would invalidate all validated queries;
the agent must commit to sort orders, encodings and auxiliary structures before writing any operator code.
One conversation per query. The agent branches after storage planning; each SQL template gets
its own independent per-query LLM conversation over a shared codebase, which localises complexity and prevents
one query’s regression from polluting another’s history.
Correctness first, performance second. A functional but slow engine is fully validated against
DuckDB across many random parameter instantiations before optimisation even starts.
No cost model — empirical join ordering. Rather than predicting the best plan, the agent
measures alternatives on downscaled data during synthesis and hard-codes the winner (or emits
multiple specialised implementations for distinct regions of the parameter space).
Expert-knowledge file. A curated distillation of decades of DBMS research (sequential access,
cache locality, SIMD, branchless code, inlining) is loaded into the agent’s context in Stage 5 so it can
apply techniques selectively to traced hotspots.
Ad-hoc / drift handling. Data is always materialisable to a flat relational format, so an
out-of-contract query falls back to a generic SQL processor over the bespoke storage. Full workload drift ⇒
re-synthesise (cheap enough to be a nightly job).
3 The Supporting Infrastructure — “A System for System Generation”
Perhaps the most transferable contribution of the paper is not the pipeline itself but the infrastructure that
makes tight iteration feasible for a full DBMS.
Four agent tools only:compile, run/benchmark, shell,
and a structured patch tool. The agent cannot touch the engine any other way.
Live hotpatching & incremental compilation. The database process keeps running across
thousands of edits; components are swapped in place, cutting validate-benchmark turnaround from minutes to
seconds.
Continuous fuzzy verification. Every candidate engine is compared against DuckDB on a
diverse set of parameter instantiations — not one “golden” run — catching bugs that a single test case
would miss.
Snapshot versioning + automatic rollback. Every accepted change is a checkpoint; regressions
are detected by an external monitor and reverted, guaranteeing monotonically improving engines.
Supervisor agent. A second LLM watches the coding agent turn-by-turn, injects targeted
corrections, and refuses to advance if a stage’s goal is not met — while staying stage-aware so it does not
push premature optimisation.
4 Where the Speedup Actually Comes From
Ablation across stages (speedup vs DuckDB)
Stage added
TPC-H
CEB
Base implementation (bespoke storage + naive code)
2.34×
2.10×
+ Actual cardinality info
3.25×
1.92×
+ Self-tracing / profiling
4.10×
3.59×
+ Expert-knowledge prompting
5.25×
6.24×
+ Human-reference persona
7.25×
10.25×
+ Multi-threading
—
—
Every stage contributes measurably; the final “think like an expert DB engineer” pass is
particularly potent because it re-examines whole functions rather than local hotspots.
Storage vs execution ablation
Setup
TPC-H — basic impl.
TPC-H — after opt.
CEB — basic impl.
CEB — after opt.
Flat struct-of-arrays storage (generic)
1.26×
5.18×
0.57×
8.09×
Bespoke storage
2.34×
12.35×
2.10×
51.40×
The takeaway: the generality tax lives beyond the operator layer. Even a compiled-query engine
(Umbra) that eliminates interpretation overhead cannot match a system that also redesigns the physical layout
around the workload. Storage and query specialisation multiply.
Concrete tricks the agent invented
TPC-H Q1: partition lineitem into nine groups keyed by
(returnflag, linestatus), each sorted by shipdate; replace scan with per-group
binary search + pure sequential AVX-512 reduction (16 elements/cycle, two accumulators for ILP).
TPC-H Q5: exploit orders sorted by orderdate; denormalise
lineitem.supp_nationkey and pre-computed discounted_price next to
orders.cust_nationkey; region/nation lookups become O(1) array indexing.
TPC-H Q13: each orders row carries an alpha_mask (which letters occur in
comment) and a bigram_mask that cheaply reject non-matching rows before any
substring scan.
Aggregate strategy usage across all queries: inline fused aggregation (97.4%),
bitmap semi-joins (73.7%), dictionary predicate rewriting (71.1%),
hash indices for O(1) joins (47.4%), pointer __restrict aliasing (50%).
5 Cost, Time, and Reproducibility
$276
API cost — Bespoke-TPC-H (Claude Sonnet 4.7)
$303
API cost — Bespoke-CEB
10–30 h
Wall-clock synthesis time
~15,000
Agent turns for Bespoke-TPC-H
~11,600
Lines of generated C++ (final engine)
~150k
Peak context tokens (with compaction)
The authors also tried other frontier models (GPT-5.4-Codex, Claude Sonnet 4.7) with comparable speedups, and
local open-weight models (Gemma-4, MiniMax-M2.7, GLM-4.7/5.1) which succeeded but required more retries. They
interpret this as an instruction-following gap, not a fundamental limit of the approach.
6 How It Relates to Prior Work
Line of work
Examples
Bespoke OLAP’s difference
Vectorised / compiled engines
MonetDB/X100, HyPer, DuckDB, Umbra
Specialise at the workload-class level; still general within OLAP. Bespoke specialises to the individual workload.
Query compilation
Neumann 2011, LegoBase, DBToaster
Only compiles the execution layer; storage stays generic. Bespoke rebuilds storage too.
Selects indexes/knobs inside a fixed architecture. Bespoke changes the architecture itself.
LLM-for-DB code generation
CodexDB, GPT-DB
Those generate isolated query kernels. Bespoke synthesises a coherent engine with cross-layer dependencies.
Autotuned kernels
FFTW, ATLAS
Autotune a single algorithm. Bespoke autotunes an entire system.
7 Limitations & Future Work
In-memory only. Buffer pool, eviction, and page layout synthesis are explicit next steps —
early disk-resident results already work but speedups shrink.
OLTP is open. Consistency and isolation add a whole new dimension the current pipeline
does not address.
Contract must be known in advance. Truly ad-hoc workloads fall back to a generic
SQL processor over the bespoke storage — correct, but no specialisation benefit.
Cost-model-free join ordering works empirically but might not scale to workloads with huge
parameter spaces; the authors suggest lightweight learned cost models to prune synthesis choices.
8 Reviewer’s Take
Strengths. The paper is a striking existence proof that a well-structured LLM agent, with the
right infrastructure (hotpatching, snapshotting, supervisor, fuzzy testing), can synthesise a non-trivial
full system and beat two decades of DBMS engineering by an order of magnitude — at commodity cost.
The ablation (Table 1 and Figure 8) is unusually honest about where the gains come from: storage
specialisation matters as much as operator specialisation.
Caveats. Results are on benchmarks whose query templates are perfectly known
in advance — the ideal setting for the approach. Real workloads change constantly; the “resynthesise nightly”
answer is elegant but unproven at fleet scale. Also, correctness verification is empirical (fuzzy comparison
vs DuckDB), not formal — subtle bugs in rare parameterisations could slip through. Finally, TPC-H and CEB are
read-only and small enough to sit in memory; the harder story (updates, disk, concurrency) is future work.
Why it’s important. The framing generalises well beyond OLAP: any complex system whose
design is dominated by a “generality tax” (compilers, network stacks, ML runtimes) is a candidate for the same
contract-driven, LLM-plus-infrastructure synthesis recipe. The infrastructure contributions — live hotpatching,
supervisor agents, snapshot rollback, per-component conversation branching — are the real reusable ideas.