arXiv:2608.22476cs.DBAug 2026

Manuscript Offprint

arXiv:2608.22476

JetStream: Generating 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 existing approaches typically assume static data and replace the database’s native storage with generated representations. We present JetStream, a system for generating query-specific accelerators that instead extend an existing DBMS.

JetStream consists of three parts. First, a staged, measurement-driven agentic workflow generates and optimizes query-specific accelerators, including persistent auxiliary state when beneficial. Second, a fixed, engine-neutral substrate provides the common interfaces for execution, transaction coordination, state management, and maintenance. Third, a separate synthesis workflow generates engine-specific backend adapters that connect the substrate to the underlying engine. For stateful accelerators, JetStream also generates maintenance logic and uses a runtime policy to choose among incremental maintenance, rebuilds, and lazy repair as the database changes.

On TPC-H at SF=20, stateful accelerators generated by JetStream achieve an 833× geomean read-only speedup over DuckDB, compared with 34.07× for GenDB and 12.35× for Bespoke OLAP. Under TPC-H refreshes every 60 seconds, JetStream maintains a 375× geomean workload speedup. We also show that JetStream generalizes to new, unseen workloads, achieving geomean read-only speedups of 102× over DuckDB and 486× over PostgreSQL. These results show that aggressive generated specialization can be integrated seamlessly with existing DBMSes, and support dynamic workloads.

1 Introduction

Relational database systems are designed to be general-purpose: they support diverse schemas and data and can execute any query expressible in their SQL dialect. But this generality comes at the cost of performance. For example, while an aggregation can be generally implemented using a hash table, if the set of groups are known ahead of time, we could instead use a direct-mapped array and eliminate the hash-probing overhead altogether.

This example shows how knowledge of a query workload and its data can enable specialized execution strategies, which we call accelerators, that outperform general-purpose database systems. Historically, building such accelerators required substantial engineering effort, and by design, sacrificed generality. Such systems were thus typically built only for query workloads important enough to justify both the engineering effort and loss of generality (e.g., performance-or revenue-critical applications [1, 2, 36]). But recent advances in large language model (LLM) code generation [4, 24, 34] are changing this trade-off by making it practical to automatically construct specialized query accelerators for known workloads [17, 31, 35].

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 Geomean Speedup over DuckDB

Figure

TPC-H (SF=20): Refresh Updates at 60s Intervals

Figure 1: JetStream combines aggressive read acceleration with support for realistic write workloads. On TPC-H SF=20, stateful JetStream achieves substantially higher read-only speedup than prior generated systems (top). Under TPC-H refreshes every 60 seconds, JetStream retains a 375×375\times geomean workload speedup over DuckDB, while systems without write maintenance fall back to parity with the base DBMS (bottom).

This raises a natural research question: can we obtain the performance benefits of specialization without giving up the generality and practicality of a conventional database system?

Systems such as GenDB [17] and Bespoke OLAP [35] take a step in this direction, both synthesizing query engines for a known workload by specializing its storage layout, data structures, and query implementations. However, as outlined in Table 1, both systems make design decisions that limit their practicality. First, they rewrite the base data itself, which complicates writes, potentially requires data to be rewritten if the workload changes, and forces users to migrate their data into the specialized format. Second, their

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

SystemAccelerates known queriesSupports ad-hoc queriesPreserves accel. under writesUses existing DBMS storage
Castor [11]✓Deductive program synthesis✕✕✕
GenDB [17]✓Agentic synthesis workflow✕✕✕
Bespoke OLAP [35]✓Agentic synthesis workflow✓Separate DBMS fallback✕✕
JetStream (this work)✓Agentic synthesis workflow✓Underlying DBMS execution✓Intelligent aux. state maintenance✓Using a general substrate

specialized data structures assume static data and lack a mechanism for incremental maintenance. After writes, they either return stale results or forgo their performance benefits altogether. Third, GenDB in particular sacrifices generality entirely by not supporting ad-hoc queries. We argue that a practical system leveraging synthesized query accelerators should retain the generality of a conventional DBMS, supporting writes and ad-hoc queries using its native storage, while delivering accelerated performance for known, pre-declared query templates.

Two challenges make achieving this difficult in practice. First, accelerator integration is susceptible to reward hacking [29]: modern coding agents can modify the system and invoke their own tests and benchmarks, making it unsafe to let the same agent optimize an accelerator and judge whether it is correct or faster. Apparent improvements can come from weakening correctness checks or exploiting measurement artifacts rather than actually improving the system, so correctness and performance evaluation must be owned by an external mechanism with fixed acceptance criteria. Second, integrating accelerators across multiple DBMSes requires more than generating query code, because engines expose different scan APIs, mutation paths, and transaction mechanisms. Encoding these details directly into every accelerator would tightly couple accelerator logic to a particular engine and force the synthesis process to repeatedly rediscover the same integration logic.

We present JetStream: a new practical system that synthesizes query-specific accelerators and incorporates them within an existing database system. JetStream addresses the first challenge with a measurement-driven synthesis workflow in which an external orchestrator, rather than a coding agent, owns correctness and performance evaluation. It addresses the second with a fixed, engine-neutral substrate that separates query-specific accelerator logic from engine-specific database integration. This separation allows JetStream to specialize aggressively without replacing the underlying database. Accelerators can execute directly over native base tables or maintain query-specific auxiliary state, while the DBMS remains responsible for canonical storage, transactions, recovery, and concurrency. Queries without accelerators continue to execute normally, and accelerators can be added, removed, or regenerated without changing the representation of the base data. Like existing systems [17, 35], JetStream applies differential testing during accelerator synthesis and uses a final audit stage (Section 2.4) to empirically validate that its accelerators match the semantics of their corresponding SQL queries. JetStream builds on top of our prior work on Tailwind [38], which non-invasively integrates manually-written accelerators into existing database systems; JetStream is the first step towards automatically generating such accelerators.

As shown in Figure 1, our evaluation shows that this design provides both aggressive specialization and practical update support. On TPC-H at SF=20, stateful JetStream accelerators achieve an 833×833\times geomean read-only speedup over DuckDB, compared with 34.07×34.07\times for GenDB [17] and 12.35×12.35\times for Bespoke OLAP [35]. With TPC-H refreshes every 60 seconds, JetStream retains a 375×375\times geomean workload speedup. On SEC-EDGAR, a workload chosen to reduce potential LLM training-data overlap, JetStream shows that it can generalize well, achieving 102×102\times and 486×486\times geomean read-only speedups over DuckDB and PostgreSQL, respectively.

In summary, we make the following contributions:

  • A measurement-driven agentic workflow for database accelerator generation. JetStream separates accelerator analysis, implementation, optimization, and validation; grounds optimization in profiling and controlled measurements; and safely synthesizes multiple query accelerators concurrently.

  • Generated accelerators that extend, rather than replace, an existing DBMS. We introduce an engine-independent substrate together with generated backend adapters that allow specialized query code to execute directly over native database storage. The same framework supports stateless or stateful accelerators and single- or multi-threaded execution.

  • A write-aware framework for generated auxiliary state. Stateful accelerators include query-specific maintenance logic that incrementally updates, rebuilds, or invalidates auxiliary state based on the expected cost of writes and future queries, together with a transactional protocol that keeps generated state consistent with committed base data after updates.

References (24)