This article explores using Large Language Models to improve database query optimization by addressing failures in traditional cardinality estimation. The authors introduce DBPlanBench, a framework that leverages LLMs to interpret physical operator graphs and perform evolutionary search for more efficient query execution plans. Results indicate that optimization strategies derived on smaller datasets effectively transfer to larger production workloads.
Key points
Traditional cost-based query optimizers struggle with cardinality estimation due to flawed assumptions about attribute independence.
Errors in row-count estimation propagate through cost models, leading to suboptimal join orders and inefficient physical plans.
LLMs can serve as semantic-aware estimators to identify better execution paths by interpreting physical plan structures.
Optimization strategies discovered on small database replicas can be successfully transferred to larger datasets, reducing computational overhead.