arXiv:2610.20527cs.DBOct 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2610.20527

JetStream: Generating Verified Query Accelerators for Existing Database Systems

Akhilesh Balasingam, Amadou Ngom, Geoffrey X. Yu, Tim Kraska

Abstract

Recent work has shown that LLMs can synthesize highly specialized database systems for fixed workloads, but these systems replace the DBMS's native storage and assume static data: users must migrate their data, often give up ad-hoc queries, and lose acceleration once the data changes. We present JetStream, which instead generates query-specific accelerators that extend an existing DBMS. Given a set of parametrized query templates, a staged agentic workflow synthesizes accelerators that run directly over the DBMS's native tables and may maintain custom auxiliary state, while the DBMS remains responsible for storage, transactions, recovery, and all other queries. A fixed, engine-neutral substrate handles engine-specific hooks and keeps auxiliary state transactionally consistent under writes. JetStream generates two kinds of accelerators: tested accelerators, which may use any optimization and are validated by differential testing, and verified accelerators which trade some performance for a machine-checked proof that every answer satisfies a trusted specification derived from the SQL. On TPC-H at SF=20, JetStream achieves a 315× geomean read speedup over DuckDB (93× verified) and retains 120× under a continuous update stream of 10,000 modified rows per second.

1 Introduction

Relational database systems are general-purpose: they support diverse schemas and data and can execute any query expressible in their SQL dialect. This generality costs performance. An aggregation, for example, is generally implemented with a hash table, but if the set of groups is known ahead of time, a direct-mapped array eliminates hash probing altogether. Knowledge of a query workload and its data enables such specialized execution strategies, which we call accelerators. Historically, building accelerators required substantial engineering effort and sacrificed generality, so they were built only for performance- or revenue-critical workloads [1, 2, 40]. Recent advances in LLM code generation [4, 28, 38] change this trade-off by making it practical to construct accelerators for known workloads automatically [20, 35, 39]. This raises a natural question: can we obtain the benefits of specialization without giving up the generality and practicality of a conventional database system?

GenDB [20] and Bespoke OLAP [39] take a step in this direction by synthesizing query engines that specialize the storage layout, data structures, and query implementations to a known workload. However, their design decisions limit their practicality (Table 1). First, they rewrite the base data, which forces users to migrate it, complicates writes, and may require rewriting it again when the workload changes. Second, their data structures assume static data and lack incremental maintenance, so after writes they either return stale results or lose their benefits. Third, GenDB does not

Geoffrey X. Yu

MIT CSAIL

Cambridge, MA, USA

geoffxy@mit.edu

Tim Kraska

MIT CSAIL

Cambridge, MA, USA

kraska@mit.edu

TPC-H (SF=20): Read-only

Figure

TPC-H (SF=20): Refresh stream, ≈\approx10.0k rows/s

Figure

Figure 1: JetStream combines aggressive read acceleration with support for realistic write workloads. On TPC-H SF=20, stateful JetStream reaches a 315× geomean read-only speedup over DuckDB (93× with verified accelerators), well above prior generated systems. Under a TPC-H refresh stream applied every 15 seconds (≈10K modified rows/s), with each accelerator running in its own process, JetStream retains a 120.5× geomean workload speedup (40.5× verified) (bottom). GenDB and Bespoke OLAP do not maintain their state under writes and are shown at parity, assuming they fall back to the base DBMS.

support ad-hoc queries at all. Fourth, both validate correctness only by testing on sampled parameters and data, which cannot rule out errors on inputs outside the tested distribution. A practical system should instead retain the generality of a conventional DBMS,

Table 1: No existing query accelerator synthesis system supports all desired practical capabilities.

SystemApproachAd-hoc queriesAccel. under writesNative DBMS storageProven correct
Castor [12]Deductive synthesis✕✕✕∘a\circ^a
GenDB [20]Agentic synthesis✕✕✕✕
Bespoke OLAP [39]Agentic synthesis✓b\checkmark^b✕✕✕
JetStreamAgentic synthesis with generated maintenance✓✓✓✓c\checkmark^c

a^{a} Correct by construction through semantics-preserving rewrites, without a machine-checked proof for each generated program. b^{b} Through a separate DBMS that holds a second copy of the data. c^{c} Optional: verified accelerators carry a machine-checked proof against a specification derived from the SQL; tested accelerators use differential testing.

supporting writes and ad-hoc queries over its native storage, while accelerating known, pre-declared query templates.

Three challenges make this difficult. First, reward hacking [33]: coding agents can modify the system and invoke their own tests and benchmarks, so apparent improvements may come from weakened correctness checks or measurement artifacts. Correctness and performance evaluation must therefore be owned by an external mechanism with fixed acceptance criteria. Second, engine integration: engines expose different scan APIs, mutation paths, and transaction mechanisms, and encoding these details into every accelerator would couple it to one engine and force synthesis to rediscover the same integration logic repeatedly. Third, verification: formal verification offers the strongest correctness guarantee, but the optimizations that make accelerators fast also make them harder to prove correct.

We present JetStream, a system that automatically synthesizes query-specific accelerators and integrates them within an existing database system. Given a set of query templates, an agentic workflow generates an accelerator for each template that runs directly over the DBMS's native tables and may maintain query-specific auxiliary state. The DBMS remains responsible for storage, transactions, and recovery: queries without accelerators execute as before, and accelerators can be added or removed without regenerating the system. JetStream builds on Tailwind [42], which integrates manually written accelerators into existing database systems and selects among them for a given workload; JetStream instead generates the accelerators and their maintenance logic automatically. It produces two kinds of accelerators. Tested accelerators may use low-level execution optimizations with few restrictions and are validated by differential testing against the host DBMS. Verified accelerators are written in a more constrained programming model and carry a machine-checked proof that every answer they return satisfies a formal specification of the query.

This design addresses each challenge. An external orchestrator, not the coding agent, owns all correctness and performance evaluation. A fixed, engine-neutral substrate sits between the generated code and the DBMS, so accelerators are written against a common interface while generated backend adapters handle engine-specific scans, mutations, and transactions. Verified accelerators are written in Verus against a specification that is generated from the SQL and frozen before any agent writes code, so agents can use any optimization they can prove correct but cannot change what is being proven.

As shown in Figure 1, this design provides both aggressive specialization and practical update support. On TPC-H at SF=20, stateful JetStream achieves a 315× geomean read-only speedup over DuckDB, compared with 34× for GenDB and 12× for Bespoke OLAP, and verified accelerators reach 93×. Under a TPC-H refresh stream of about 10K modified rows per second, JetStream retains a 120× geomean workload speedup (40× verified), while systems without write maintenance can at best fall back to the performance of the base DBMS. Even with all 22 verified accelerators in one process, sharing the verified store and a single writer, JetStream remains 7.5-8.1× faster than DuckDB at the same write rate (Section 6.4). On SEC-EDGAR [20], a workload built from real financial filings and less likely to appear in LLM training data, JetStream achieves 744× and 3508× geomean read-only speedups over DuckDB and PostgreSQL, respectively.

In summary, we make the following contributions:

  • A profiling-driven agentic workflow for generating accelerators that extend, rather than replace, an existing DBMS. It separates accelerator generation from evaluation and produces highly optimized accelerators that run over the DBMS's native storage while it continues to serve other queries.

  • An engine-neutral substrate and a framework for write-aware maintenance of auxiliary state. The substrate decouples accelerators from engine-specific integration, and the framework incrementally updates, rebuilds, or invalidates auxiliary state to keep it transactionally consistent with the base data under writes.

  • A methodology for generating verified accelerators. JetStream generates accelerators with machine-checked proofs that every answer they return satisfies a specification derived mechanically from the SQL, retaining substantial speedups while providing a stronger correctness guarantee than differential testing.

References (27)