用大模型自动生成定制化查询代码,提升数据库性能
Demonstrating GenDB: Instance-Optimized and Customized Query Processing Code Generation via LLM Agents

- 通过大模型代理分析数据和负载,生成针对具体场景的优化查询代码
- 在TPC-H和新基准上表现优于现有引擎,性能提升显著
- 适合需要频繁执行相似查询的系统,支持用户自定义数据与模型
传统查询处理引擎因内部复杂性难以扩展,新系统构建成本高昂。为此,我们演示了GenDB——一个基于大语言模型(LLM)的生成式查询引擎,将查询处理从手工实现转向代码自动生成。早期原型利用LLM代理为特定数据、工作负载和硬件资源生成实例优化的查询执行代码,适用于重复性高、模板化的离线查询,其前期生成成本可通过多次执行分摊,且通过大量模糊测试和人工检查确保正确性。对于临时查询,GenDB采用混合架构:传统数据库处理一次性请求,而GenDB加速高频SQL模板。演示支持用户交互式探索GenDB如何分析工作负载、硬件和数据,生成查询计划并产出高效代码;对比显示其在TPC-H及新设计的去泄露基准上显著优于当前最优引擎;用户还可上传自有数据与查询,测试不同LLM和查询模式下的表现。
原文摘要 · Abstract (English)
Traditional query processing engines require continuous development and extensions to support new techniques and user requirements, and in some cases, entirely new systems must be built from scratch. However, these engines are difficult to extend due to their internal complexity, and building new systems demands significant engineering effort and cost. To address this, we demonstrate GenDB, a generative query engine that shifts query processing from manually engineered systems to query processing code generation driven by Large Language Models (LLMs). An early prototype of GenDB uses LLM agents to generate instance-optimized query execution code tailored to specific data, workloads, and hardware resources. This prototype suits offline code generation for repetitive, templated queries, since the upfront generation cost amortizes over many executions and correctness can be ensured through extensive fuzz testing and manual inspection. For ad-hoc queries, GenDB can work with a traditional DBMS in a hybrid architecture: the DBMS handles one-off queries, while GenDB speeds up frequent SQL templates. Our demonstration allows users to (1) visually and interactively explore how GenDB analyzes workloads, profiles hardware resources and underlying data, produces query plans, generates code based on them, and finally uses an optimizer to iteratively achieve a correct and efficient implementation; (2) use visual inspection and analysis to gain qualitative insights into why GenDB produces code that achieves significantly better performance than state-of-the-art query engines on two benchmarks: TPC-H and a newly constructed benchmark designed to reduce potential data leakage from LLM training data; and (3) upload their own data and queries to explore GenDB with different LLMs and query patterns.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。