Realistic Performance-Aware Query Generation
Database research and development rely heavily on representative workloads for benchmarking, regression testing, and system evaluation. However, acquiring real-world SQL queries is notoriously difficult due to strict privacy constraints. While cloud database vendors have begun releasing anonymized performance traces, these traces typically expose only execution statistics rather than executable SQL queries, which limits their usefulness for end-to-end evaluation. Existing methods either operate at coarse granularity or fail to generate runnable workloads that reproduce per-query execution behavior with both high fidelity and efficiency. To address this gap, we propose ResQ, a fine-grained workload synthesis system that generates executable SQL workloads matching the per-query execution targets and operator composition of production traces. ResQ decomposes trace-driven synthesis into bounded query-graph construction and predicate instantiation, while using repetition-aware reuse and lightweight local models to make search practical and scalable. Across public cloud traces and a new industrial trace, ResQ substantially outperforms prior workload-generation baselines, reducing the 99th-percentile q-error by geometric-mean factors of 9.0x for CPU time and 120.4x for scanned bytes relative to the baseline method, while also cutting prompt-token usage and end-to-end generation time by 96.0% and 96.3%, respectively.