SQLBarber: A System Leveraging Large Language Models to Generate Customized and Realistic SQL Workloads
Jiale Lao, Immanuel Trummer
Cornell University
Key points
From the paper's conclusion- To address this issue, we present SQLBarber, a system based on Large Language Models (LLMs) to generate customized and realistic SQL workloads.
Abstract
Database research and development often require a large number of SQL queries for benchmarking purposes. However, acquiring real-world SQL queries is challenging due to privacy concerns, and existing generation methods offer limited options for customization and for satisfying realistic constraints. To address this issue, we present SQLBarber, a system based on Large Language Models (LLMs) to generate customized and realistic SQL workloads. SQLBarber (1) eliminates the need for users to manually craft SQL templates in advance, while providing the flexibility to accept natural language specifications to constrain SQL templates, (2) scales efficiently to generate large volumes of queries matching any user-defined cost distribution (e.g., cardinality and execution plan cost), and (3) uses execution statistics from production environments to extract SQL template specifications and query cost distributions that reflect real-world query characteristics. SQLBarber introduces (1) a declarative interface for users to effortlessly generate customized SQL templates, (2) an LLM-powered pipeline augmented with a self-correction module that profiles, refines, and prunes SQL templates based on query costs, and (3) a Bayesian Optimizer to efficiently explore predicate values and identify a set of queries that satisfy the target cost distribution. We construct and open-source ten benchmarks of varying difficulty levels and target query cost distributions based on real-world statistics from Snowflake and Amazon Redshift. Extensive experiments on these benchmarks show that SQLBarber is the only system that can generate customized SQL templates. It reduces query generation time by one to two orders of magnitude and significantly improves alignment with the target cost distribution, compared with existing methods.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- Text-to-SQL in the Era of Large Language Models: A Survey of Reasoning-Centric and Efficiency-Centric ApproachesElectronics · 2026
- LuthorSQL: A One-Pass Text-to-SQL Model as System 1 for a Slower LLM AgentarXiv · 2026
- GenRewrite: Query Rewriting via Large Language ModelsProceedings of the ACM on Management of Data · 2026
- Reimagining Text-to-SQL: A Survey of Large Language Model Architectures and StrategiesarXiv · 2026
- Cracking Query Bottlenecks: Towards Efficiency-Oriented Text-to-SQL GenerationProceedings of the ACM on Software Engineering · 2026
- Uber-Join: Unifying Diverse Table Joins using LLMs with Precision and Cost GuaranteesarXiv · 2026