Lune

ICDE2026Top-tier venue

TemplateQO: Template-Aware and Scalable Query Optimization with Data-Efficient Learning

Pengfei Zheng, Guoneng Li, Ling Xu, Rong Zhu, Yan Li, Bolong Zheng

2026Year

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.

Questions to start from

Your agent calls

Lunesearch_papers

Ask in Lune

Free to start. No credit card required.

Related papers

Dusk over the sea between two cliffs drawn in fine vertical lines