Realistic Performance-Aware Query Generation
Listen
Radio episode about this paper
Transcript
Introduction to the show: ident: Computer Science. The day in computer science: software, systems and theory on arXiv.
Tom: I'm Tom.
Jane: And I'm Jane, here with Lu, Meng and our in-house large language model, Lalam.
Tom: We're looking at the paper: "Realistic Performance-Aware Query Generation".
Paper summary: Tom: So we're looking at this paper today called "Realistic Performance-Aware Query Generation," by Zhengle Wang and others. Basically they’re tackling the problem of creating real SQL queries that actually look like what users are running in production, which is tough because of privacy rules.
Jane: That sounds really important because databases rely on these realistic workloads to test performance and tune systems, but getting actual user queries is almost impossible to get legally.
Tom: Exactly. The core problem they're facing is that existing synthetic workloads often give misleading benchmark results, so this paper proposes something called ResQ, which is a fine-grained system for generating executable SQL that matches the execution targets and operator distributions of production traces.
Lu: What's interesting about ResQ is that they are building a very structured pipeline to get this fidelity without just guessing, because matching multiple execution targets per query is much harder than just hitting one big cost target.
Meng: I wonder how they manage the complexity of matching those multiple targets across different operators; in production, you don't just want to hit one number, you want the whole execution profile to be right.
Lalam: The abstract says ResQ constructs an execution-aware query graph and focuses on matching both structural constraints and execution targets simultaneously, which is a big step because previous methods either did it coarsely or used LLMs in ways that made fine-grained control difficult.
Jane: So, what does this mean for us? It means we can finally generate workloads that are much closer to reality than what we've seen before, which is crucial for accurate performance diagnosis.
Tom: Right. And the paper claims they solved this by explicitly separating the construction of the structure, bounding the search space based on data awareness and then refining it using cost-aware refinement to hit those CPU time targets.
Lu: I'm curious about that two-phase pipeline; Phase One builds a base query graph that satisfies structural constraints over a proxy dataset, and Phase Two uses local performance models to guide the search toward the target execution time.
Paper summary: Meng: Local performance models sound fast, but how reliable are they when you're trying to prune candidates in a massive search space? I need to know if we're just spending time running too many queries before we even start refining.
Tom: The paper says these lightweight local prediction models estimate things like CPU time from operator-level features and intermediate statistics, and they use that feedback both for cost-aware bounding to prune infeasible queries early, and during the search phase to give cheap feedback for the exploration.
Jane: So, it’s a way to be smart about where you look in the search space instead of just running every single candidate query to completion. That sounds like a practical efficiency gain.
Lu: And they address repetition patterns by using two levels of query pools: one based on exact query hash for structural repetition, and another based on parameterized hash which normalizes the parameters and predicates across different queries.
Meng: Reusing queries is good, but when you're matching execution profiles, does reusing a structurally similar query actually guarantee matching the execution statistics you need? That’s where I worry about fidelity.
Lalam: The paper claims this dual-level pool helps manage challenge two by providing both exact structural repetition and parameterized abstraction, which means they can reuse patterns efficiently while still allowing for fine-grained control over parameters during refinement.
Tom: So the paper shows a significant improvement in efficiency too; they report gains like ninety-six point seventy-one percent token savings and an eighty six point ninety seven percent reduction in runtime compared to state of the art baselines on tests like Snowset, Redset, and the new Bendset trace.
Jane: That reduction in runtime is huge for anyone doing capacity planning or autoscaling; it means faster iteration cycles when building performance tests.
Lu: The results on Bendset Trace two are particularly interesting because ResQ achieves a median CPU Time Q error of one point thirteen which beats SQLBarber at two point thirty-one and SQLSmith-Q at two point nineteen by a factor close to two.
Paper summary: Meng: A factor of two improvement is significant, but I still need to see how this holds up when we introduce real traffic patterns that aren't just from those public traces. That's where I have my doubts about generalizing the performance modeling aspect.
Tom: The authors show that ResQ consistently achieves the best target-fitting accuracy across both CPU time and scanned bytes, and they also maintain near zero mean absolute error for Join, Aggregate, and Sort operators in Table four.
Jane: So it’s not just about getting the total CPU time right; it’s granular accuracy on specific operations like joins and sorts too. That tells us the model is really learning the execution behavior at a deeper level.
Lu: The paper also released a new fine-grained workload trace called Bendset, which covers diverse real-world use cases, suggesting they tested this system against something more complex than just existing public data.
Meng: Testing on that new industrial trace is important because that's what we actually deal with at scale, and it shows the system can handle diversity in a way prior methods couldn't.
Lalam: The paper concludes by saying ResQ achieves high fidelity and efficiency across Snowset, Redset, and the newly released Bendset.
Tom: So to wrap up on "Realistic Performance-Aware Query Generation," this work moves beyond just generating queries that are syntactically correct or hitting a single cost target.
Jane: It’s about matching the fine-grained execution targets and operator distributions of real production traces, and they achieved this using a structured pipeline with data-aware bounding and cost-aware refinement.
Lu: For the world, this suggests that we can move toward synthesizing workloads that are far more representative of actual user behavior than what was previously possible.
Meng: From an engineering standpoint, it means we have a framework for generating realistic performance tests much faster and with better accuracy than before.
Lalam: The authors conclude that ResQ achieves high fidelity and efficiency on Snowset, Redset, and the newly released Bendset.
Conclusion: Tom: So we've been looking at this paper, "Realistic Performance-Aware Query Generation." Basically, they built a system called ResQ to make SQL queries that actually look like what real users run in production.
Jane: That’s right, Tom. They are taking the problem of creating realistic data for performance testing and making it fine-grained so it matches the execution targets perfectly.
Lu: The authors focus on matching not just a single cost target, but all those different execution profiles per query, which is a much harder task than the older methods they were trying to beat.
Meng: So what’s the actual result here? Is this system actually deployable on a real database where I can use it for testing?
Tom: Well, the numbers are pretty impressive. They showed that ResQ significantly outperformed existing systems on public cloud traces like Snowset and Redset.
Jane: They achieved things like a ninety-six point seventy-one percent token saving and an eighty six point ninety seven percent reduction in runtime when compared to the baselines they tested against.
Lu: Specifically, on a new industrial trace they released, Bendset, ResQ showed a median CPU Time error of one point thirteen. That beats SQLBarber by about two times.
Meng: Two times is good, but that’s still just a number on a benchmark. What happens when you put this thing on real traffic that isn't in those public traces?
Jane: That’s the next question, Meng. The paper shows they tested it against Bendset, which is supposed to be more industrial use cases, so it suggests the approach is more robust than just running it on clean public data.
Tom: Exactly. They even found near zero mean absolute error for operations like Join and Aggregate operators in their results table.
Lu: So the core idea is this structured pipeline—bounding the search space first, then using those local performance models to refine the query toward those specific CPU time targets.
Jane: That’s a lot of complexity managed by a very smart search strategy rather than just brute force generation.
Meng: It sounds like they solved the problem of generating realistic workloads without having to manually craft every single complex query from scratch.
Tom: Right. The implication is that we can generate workloads that are way closer to what users actually do, which means our performance testing becomes much more useful for real system tuning.
Jane: It’s a step toward making synthetic data genuinely representative of how databases behave in the wild, and they did it using this new approach called ResQ.
Purdue University · Databend Cloud
cs.DB
Submitted: 2026-02-03
Updated: 2026-12-02
Code: https://github.com/WASSER2545/ResQ
License: http://arxiv.org/licenses/nonexclusive-distrib/1.0/
Importance score: 85/100
The gist: Realistic Performance-Aware Query Generation proposes ResQ, a fine-grained workload synthesis system designed to generate executable SQL workloads that faithfully match the per-query execution…
Key concepts
- Realistic Performance-Aware Query Generation (RPQG)
- This is the core problem of creating executable SQL queries that not only follow structural rules but also closely mimic how real user queries actually run in a production database. The goal is to synthesize a query ($q^*$) that satisfies structural constraints while matching specific execution targets ($Y$) like CPU time and operator usage.
- Two-Phase Generation Pipeline
- ResQ uses a two-step approach to build the target query. Phase I first builds a basic query graph that respects the required structure. Phase II then takes this base and refines it using cost estimates to precisely hit the desired execution time targets, ensuring performance fidelity.
- Local Performance Models
- These are lightweight models embedded in ResQ that estimate important metrics, primarily CPU time, directly from a query's operator features. They are used strategically during the search process to quickly prune bad candidates early (bounding) and guide the refinement steps efficiently.
Terminology
Summary
Realistic Performance-Aware Query Generation proposes ResQ, a fine-grained workload synthesis system designed to generate executable SQL workloads that faithfully match the per-query execution targets and operator distributions of production traces. p. 0<ref:2602.02999#pg1,To bridge this gap, we propose ResQ, a fine-grained workload synthesis system designed to generate executable SQL workloads that faithfully match the per-query execution targets and operator distributions of production traces>
Problem Definition and Motivation
The paper addresses the challenge of acquiring real-world SQL queries due to privacy regulations.<ref:2602.02999#pg1,Modern cloud database systems rely heavily on realistic workloads to evaluate performance, guide system tuning, and support instance optimization (e. p. 0g., capacity planning and autoscaling) [5, 13, 15, 16, 19, 29]>. p. 0 This motivates a growing need for realistic performance-aware workload synthesis: generating executable SQL workloads whose query execution behavior closely matches that of real user queries observed in production. p. 0<ref:2602.02999#pg1,Without faithful execution profiles, synthetic workloads can lead to misleading benchmark results, suboptimal configurations, and inaccurate performance diagnosis>. p. 0 The core problem is defined as the realistic performance-aware query generation problem (RPQG), which seeks to synthesize an executable query that satisfies structural constraints and matches execution targets. p. 2<ref:2602.02999#pg3,Given (i) a testing environment D, (ii) a target structural profile C, and (iii) a target execution profile Y, the realistic performance-aware query generation problem is to synthesize an executable query q* for some template t and parameter vector \\theta such that q* satisfies the structure-aware constraints C, and matches the execution targets Y as closely as possible when executed in D>
ResQ Architecture and Pipeline
ResQ employs a structured, performance-aware generation pipeline to address fine-grained control and efficiency challenges.<ref:2602.02999#pg3>. The system consists of several components including generator data preparation, a two-phase generation pipeline, a query graph translator, local performance models, and a query pool. p. 3<ref:2602.02999#pg4>
The two-phase generation pipeline first bounds the search space using data-aware bounding and then refines the query toward the target CPU time using cost-aware refinement.<ref:2602.02999#pg4,Phase I: Space bounding and base graph construction. p. 3 ResQ first builds a base query graph that satisfies the structure-aware constraints C and is feasible over the proxy dataset \Delta>. p. 3 Phase II focuses on cost-aware refinement and predicate instantiation to match CPU time targets. p. 3<ref:2602.02999#pg4,Phase II: Cost-aware refinement and predicate instantiation. p. 3 Starting from a bounded base graph, ResQ refines the query toward the target CPU time in Y>
Key Technical Mechanisms
ResQ utilizes several mechanisms to manage complexity and ensure fidelity.<ref:2602.02999#pg3>. To address challenge (C2), ResQ deploys a query pool that supports retrieval and reuse of previously generated queries at two levels: (i) the query hash level, which captures exact structural repetition, and (ii) the parameterized query hash level, which abstracts query templates by normalizing predicate values and parameters. p. 1<ref:2602.02999#pg4>
Performance Modeling and Efficiency
To manage the expense of running every candidate query, ResQ incorporates lightweight local performance models to estimate key metrics like CPU time.<ref:2602.02999#pg5,ResQ therefore incorporates lightweight local performance models to estimate key metrics—most importantly CPU time—from operator-level features of a candidate query graph and its intermediate statistics>. p. 6 These models are used in two ways: during cost-aware space bounding to prune infeasible candidates early, and during predicate search to provide cheap feedback for BO exploration. p. 8<ref:2602.02999#pg7,ResQ therefore incorporates lightweight local performance models to estimate key metrics—most importantly CPU time—from operator-level features of a candidate query graph and its intermediate statistics>. p. 6 The efficiency gain from the local model is demonstrated in the ablation study, showing that ResQ improves generation efficiency compared to versions without it. p. 9<ref:2602.02999#pg11,As shown in Figure 4, we evaluate the local model’s efficiency on Bendset trace 2, the inclusion of the local model significantly enhances the generation efficiency>
Experimental Results and Contributions
Experiments on public cloud traces (Snowset, Redset) and a newly released industrial trace (Bendset) demonstrate that ResQ significantly outperforms state-of-the-art baselines.<ref:2602.02999#pg1,Experiments on public cloud traces (Snowset, Redset) and a newly released industrial trace (Bendset) demonstrate that ResQ significantly outperforms state-of-the-art baselines, achieving 96. p. 071% token savings and a 86. p. 097% reduction in runtime>. p. 0 Specifically on Bendset Trace 2, ResQ achieves a median CPU Time Q-error of 1. p. 913, outperforming SQLBarber (2. p. 931) and SQLSmith-Q (2. p. 819) by a factor of nearly 2× <ref:2602. p. 902999#pg10,Tables 7 and 8 show that ResQ consistently achieves the best target-fitting accuracy across both CPU time and scanned bytes>. p. 9 Furthermore, ResQ maintains near-zero MAE for Join, Aggregate, and Sort operators in Table 4. p. 9<ref:2602.02999#pg11>. The paper also releases a new fine-grained workload trace, Bendset, covering diverse real-world use cases. p. 2<ref:2602.02999#pg6>. The authors conclude that ResQ achieves high fidelity and efficiency on Snowset, Redset, and the newly released Bendset. p. 0 p. 0<ref:2602.02999#pg13>
Related Work Context
Existing methods are broadly classified into two lines: optimizer-based cost-aware query generation and realistic performance-aware query generation.<ref:2602.02999#pg13>. The realistic performance-aware setting differs fundamentally from targeted query generation because it aims to match multiple observed execution-level metrics per query and their repetition patterns. p. 2<ref:2602.02999#pg13>. The paper contrasts its approach by emphasizing matching multiple execution-level metrics per query rather than a single logical plan/optimizer-level cost target. p. 8<ref:2602.02999#pg13>. The authors note that while PBench uses LLMs for workload synthesis, ResQ explicitly optimizes for or systematically evaluates per-query execution-profile matching accuracy. p. 2<ref:2602.02999#pg13>
Conclusion
ResQ achieves high fidelity and efficiency on Snowset, Redset, and the newly released Bendset.<ref:2602.02999#pg13>. The authors conclude that ResQ achieves high fidelity and efficiency on Snowset, Redset, and the newly released Bendset.<ref:2602.
Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.
Improvements for AI systems
-
Realistic Performance-Aware Query Generation System ResQ can generate executable SQL workloads that faithfully match per-query execution targets and operator distributions of production traces, bridging the gap left by coarse-level synthesis.
-
The system constructs execution aware query graphs to define join graphs, operator types, and dataflow without committing to concrete SQL syntax in the first phase. This allows for a search over query graphs that satisfy structural constraints before instantiation.
-
ResQ deploys a two phase generation pipeline where Phase I performs data aware space bounding using greedy algorithms to prune candidates based on scanned bytes, and Phase II refines the graph using cost aware checks and performance aware predicate search to match CPU time targets.
-
The system employs a query pool supporting retrieval and reuse at exact query hash level for structural repetition and parameterized query hash level for template-level repetition, recovering workload locality efficiently.
-
ResQ utilizes lightweight local performance models to estimate key metrics like CPU time from operator level features, which are used to guide cost aware bounding and reduce expensive full queries during the Bayesian optimization process.
-
The system's two stage predicate tuning uses global exploration in Stage 1 followed by local refinement around seeds in Stage 2, guided by a hybrid scoring strategy that predicts CPU time using local models before executing the query if the prediction falls within a tolerance window.
Sources
- DeepDB: Learn from Data, not from Queries!
- Learned Cardinalities: Estimating Correlated Joins with Deep Learning
- Redbench: A Benchmark Reflecting Real Workloads
- SQLBarber: A System Leveraging Large Language Models to Generate Customized and Realistic SQL Workloads
- NeuroCard: One Cardinality Estimator for All Tables
- Blueprinting the Cloud: Unifying and Automatically Optimizing Cloud Data Infrastructures with BRAD -- Extended Version
Related papers
- ELASTIC: Trajectory-Based Synchronization of Event and Tracking Data in Soccer
- Beyond Overlap: Hierarchical Graph Abstraction for Out-of-Core Vector Search
- Async-fork: Mitigating Query Latency Spikes Incurred by the Fork-based Snapshot Mechanism from the OS Level
- EMA: Approximate Nearest Neighbor Search with General Attribute Filtering and Dynamic Updates
- Open Biomedical Knowledge Graphs at Scale: Construction, Federation, and AI Agent Access with Samyama Graph Database
- Samyama: A Unified Graph-Vector Database with In-Database Optimization, Agentic Enrichment, and Hardware Acceleration