[论文解读] ResQ: Realistic Performance-Aware Query Generation
ResQ 生成可执行的 SQL 工作负载,忠实再现来自匿名生产追踪的每个查询的执行目标和算子分布,采用两阶段查询图生成、重复感知查询池和带成本感知的优化。
Database research and development rely heavily on realistic user workloads for benchmarking, instance optimization, migration testing, and database tuning. However, acquiring real-world SQL queries is notoriously challenging due to strict privacy regulations. While cloud database vendors have begun releasing anonymized performance traces to the research community, these traces typi- cally provide only high-level execution statistics without the origi- nal query text or data, which is insufficient for scenarios that require actual execution. Existing tools fail to capture fine-grained perfor- mance patterns or generate runnable workloads that reproduce these public traces with both high fidelity and efficiency. To bridge this gap, we propose ResQ, a fine-grained workload synthesis sys- tem designed to generate executable SQL workloads that faithfully match the per-query execution targets and operator distributions of production traces. ResQ constructs execution-aware query graphs, instantiates them into SQL via Bayesian Optimization-driven pred- icate search, and explicitly models workload repetition through reuse at both exact-query and parameterized-template levels. To ensure practical scalability, ResQ combines search-space bounding with lightweight local cost models to accelerate optimization. Ex- periments on public cloud traces (Snowset, Redset) and a newly released industrial trace (Bendset) demonstrate that ResQ signif- icantly outperforms state-of-the-art baselines, achieving 96.71% token savings and a 86.97% reduction in runtime, while lowering maximum Q-error by 14.8x on CPU time and 997.7x on scanned bytes, and closely matching operator composition.
研究动机与目标
- 在隐私约束下,动员在云数据库基准测试中使用现实、逐查询工作负载的必要性。
- 形式化从匿名追踪中生成满足结构与执行目标的查询的问题。
- 提出一个两阶段、性能感知的生成流水线,在不访问原始数据的前提下产生可执行的 SQL。
- 通过轻量级成本模型实现重复感知的合成与可扩展的生成,以支持大规模基准测试。
提出的方法
- 用面向执行的图(查询图 G)来表示查询,以在 SQL 语法之前捕捉算子与数据流。
- 使用两阶段过程:阶段 I 通过数据访问和成本可行性来界定搜索空间,生成可行的基础图;阶段 II 进行谓词搜索以匹配 CPU 时间目标。
- 通过专用翻译器将查询图中的边实例化为可执行的 SQL,并在语句细节上借助大型语言模型(LLM)实现方言特定的细节。
- 利用轻量级本地性能模型估算 CPU 时间并引导贝叶斯优化,降低昂贵的实际执行成本。
- 维护一个包含精确与参数化重用的查询池,以恢复重复性并提升效率。
实验结果
研究问题
- RQ1如何从匿名追踪中合成满足逐查询执行目标和结构感知约束的可执行 SQL 查询?
- RQ2两阶段数据感知的图生成方法是否能够生成高保真度的工作负载,重现重复性和算子分布?
- RQ3哪些机制(如本地成本模型、贝叶斯优化、查询池)能够在大规模、隐私保护的前提下实现可扩展、准确的工作负载生成?
主要发现
- ResQ 在忠实度方面对目标追踪表现显著,同时降低成本:可实现多达 96.71% 的 token 节省和 86.97% 的运行时降低。
- ResQ 将 CPU 时间和扫描字节的最大 Q-误差分别降低了 14.8× 和 997.7×。
- ResQ 的算子组成与逐查询目标匹配密切,对比粗略窗口方法具有更细粒度的匹配。
- 阶段 I 的数据感知边界有效通过在谓词调优前界定扫描字节来剪枝不可行图。
- 阶段 II 采用两阶段贝叶斯优化进行谓词调优,在目标 CPU 时间附近改进探索与利用。
更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。