Bespoke OLAP: Synthesizing Workload-Specific, One-Size-Fits-One Database Engines

Authors: Johannes Wehrstein, Timo Eckmann, Matthias Jasny, Carsten Binnig (TU Darmstadt / Microsoft Gray-Systems-Lab / DFKI / hessian.AI) · Venue: PVLDB Vol. 19, No. 11, 2026 · arXiv: 2603.02001v2 (23 Jul 2026) · Code: DataManagementLab/BespokeOLAP

Databases OLAP LLM code synthesis Systems research C++

TL;DR

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

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.

4  Where the Speedup Actually Comes From

Ablation across stages (speedup vs DuckDB)

Stage addedTPC-HCEB
Base implementation (bespoke storage + naive code)2.34×2.10×
+ Actual cardinality info3.25×1.92×
+ Self-tracing / profiling4.10×3.59×
+ Expert-knowledge prompting5.25×6.24×
+ Human-reference persona7.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

SetupTPC-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 storage2.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

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 workExamplesBespoke OLAP’s difference
Vectorised / compiled enginesMonetDB/X100, HyPer, DuckDB, Umbra Specialise at the workload-class level; still general within OLAP. Bespoke specialises to the individual workload.
Query compilationNeumann 2011, LegoBase, DBToaster Only compiles the execution layer; storage stays generic. Bespoke rebuilds storage too.
Physical-design / auto-tuningAutoAdmin, DB2 Advisor, OtterTune, self-driving DBs Selects indexes/knobs inside a fixed architecture. Bespoke changes the architecture itself.
LLM-for-DB code generationCodexDB, GPT-DB Those generate isolated query kernels. Bespoke synthesises a coherent engine with cross-layer dependencies.
Autotuned kernelsFFTW, ATLAS Autotune a single algorithm. Bespoke autotunes an entire system.

7  Limitations & Future Work

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.