TemplateQO: Template-Aware and Scalable Query Optimization with Data-Efficient Learning
Pengfei Zheng, Guoneng Li, Ling Xu, Rong Zhu, Yan Li, Bolong Zheng
Abstract
Learning-based query optimizers have demonstrated strong performance across various scenarios. However, most of these approaches rely heavily on estimated cardinalities, and inaccuracies in these estimates may significantly degrade their effectiveness in certain cases. Moreover, in our experiments we observe as the training data grows, these optimizers often encounter performance plateaus, indicating limited ability to leverage richer data distributions. To address these two challenges, we develop a novel query optimizer TemplateQO, which groups queries according to the canonical join template they instantiate, and employs a unified model to optimize over all templates. We assign a unified set of candidate query plans to each template, thus eliminating the need to encode execution plans. To facilitate information flow between templates, we propose a feature extractor and a feature-fusion Transformer. These two modules are shared for all templates, in order to capture relations across tables and columns. By focusing on precise, query-level features instead of potentially inaccurate estimated plan featuers, TemplateQO can more effectively learn the underlying mapping between queries and their execution plans. Moreover, to efficiently adapt to evolving workloads, we introduce a lightweight fine-tuning method. The fine-tuning method preserves previously learned knowledge, enabling effective continual learning. Experiments indicate that TemplateQO effectively improves query performance, exhibits strong scalability, and significantly lowers planning time.
Ask about this paper
Ask your agent about it.
Lune has read the top-tier papers around this one, so every answer names the papers it rests on.
Related papers
- Practical Parameterized Query Optimization via Efficient Plan Reuse and List-wise RankingHai Lan, Yang Yu, Zhifeng Bao, Zi Huang et al.SIGMOD 2026
- ASM: Harmonizing Autoregressive Model, Sampling, and Multi-dimensional Statistics Merging for Cardinality EstimationKyoungmin Kim, Sangoh Lee, Injung Kim, Wook-Shin HanSIGMOD 2024 · 18 citations
- Speeding Up End-to-end Query Execution via Learning-based Progressive Cardinality EstimationFang Wang, Xiao Yan, Man Lung Yiu, Shuai Li et al.SIGMOD 2023 · 24 citations
- Divo: Learning a Stable and Effective Query Optimizer with a Diverse WorkloadTianyi Chen, Jun Gao, Yaofeng Tu, Yang Lin et al.SIGMOD 2026 · 1 citation
- Approximate SketchesBrian Tsan, Asoke Datta, Yesdaulet Izenov, Florin RusuSIGMOD 2024 · 5 citations
