FOSS: A learned doctor for query optimization

Abstract

Query optimizer is a critical component of a database management system, significantly impacting both user experience and resource utilization. To further enhance the capabilities of query optimizers, recent research has explored the application of deep learning. They either learn to construct plans from scratch in a bottom-up manner or steer the plan generation behavior of the traditional optimizer using hints. While they have shown promising results on certain workloads, they often suffer from low training efficiency or a constrained plan search space. To address these challenges, we introduce FOSS, a novel learned framework for query optimization. Our key insight is that while traditional optimizers may produce suboptimal plans due to estimation errors, only minor adjustments to specific suboptimal nodes are sufficient to achieve a highly efficient execution plan. FOSS assigns a reinforcement learning-based planner to refine the original plan generated by the traditional optimizer, making targeted modifications through a sequence of actions. Additionally, an evaluator is employed to assess candidate plans and select the final execution plan. To accelerate planner training, we integrate the evaluator and the traditional optimizer to construct a simulated environment, which enables the rapid generation of high-quality simulated experiences for planner updates. We evaluate the performance of FOSS on PostgreSQL and MySQL using the Join Order Benchmark, TPC-DS, and Stack Overflow workloads. The experimental results demonstrate that FOSS outperforms the state-of-the-art methods in terms of latency performance. FOSS achieves a total latency speedup of 1.30x to 9.09x over PostgreSQL and 1.35x to 7.14x over MySQL across various benchmarks.

Publication
VLDB Journal
Luming Sun
Luming Sun
Senior R&D Engineer

My research interests include AI4Sys, AI4DB (especially Query Optimization).