Lune

VLDB2022Top-tier venue

QueryFormer: A Tree Transformer Model for Query Plan Representation

Yue Zhao, Gao Cong, Jiachen Shi, Chunyan Miao

Abstract

Machine learning has become a prominent method in many database optimization problems such as cost estimation, index selection and query optimization. Translating query execution plans into their vectorized representations is non-trivial. Recently, several query plan representation methods have been proposed. However, they have two limitations. First, they do not fully utilize readily available database statistics in the representation, which characterizes the data distribution. Second, they typically have difficulty in modeling long paths of information flow in a query plan, and capturing parent-children dependency between operators. To tackle these limitations, we propose QueryFormer, a learning-based query plan representation model with a tree-structured Transformer architecture. In particular, we propose a novel scheme to integrate histograms obtained from database systems into query plan encoding. In addition, to effectively capture the information flow following the tree structure of a query plan, we develop a tree-structured model with the attention mechanism. We integrate QueryFormer into four machine learning models, each for a database optimization task, and experimental results show that QueryFormer is able to improve performance of these models significantly.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

39 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Automatic View Generation with Deep Learning and Reinforcement Learning cites An End-to-End Learning-based Cost Estimator
  • Automatic View Generation with Deep Learning and Reinforcement Learning cites Reinforcement Learning with Tree-LSTM for Join Order Selection
  • A Comparative Study and Component Analysis of Query Plan Representation Techniques in ML4DB Studies cites Automatic View Generation with Deep Learning and Reinforcement Learning
  • A Comparative Study and Component Analysis of Query Plan Representation Techniques in ML4DB Studies cites An End-to-End Learning-based Cost Estimator
  • A Comparative Study and Component Analysis of Query Plan Representation Techniques in ML4DB Studies cites Reinforcement Learning with Tree-LSTM for Join Order Selection
  • A Comparative Study and Component Analysis of Query Plan Representation Techniques in ML4DB Studies cites Bao: Making Learned Query Optimization Practical
  • Sample-Efficient Cardinality Estimation Using Geometric Deep Learning cites An End-to-End Learning-based Cost Estimator
  • LLM-R2: A Large Language Model Enhanced Rule-based Rewrite System for Boosting Query Efficiency cites A Comparative Study and Component Analysis of Query Plan Representation Techniques in ML4DB Studies
  • An End-to-End Learning-based Cost Estimator cites Reinforcement Learning with Tree-LSTM for Join Order Selection
  • Reinforcement Learning with Tree-LSTM for Join Order Selection cites An End-to-End Learning-based Cost Estimator
  • Bao: Making Learned Query Optimization Practical cites An End-to-End Learning-based Cost Estimator
  • Breaking It Down: An In-depth Study of Index Advisors cites An End-to-End Learning-based Cost Estimator
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers39

  1. LLM-R2: A Large Language Model Enhanced Rule-based Rewrite System for Boosting Query EfficiencyZhaodonghui Li, Haitao Yuan, Huiming Wang, Gao Cong et al.VLDB 2025 · 52 citations
  2. Breaking It Down: An In-depth Study of Index AdvisorsWei Zhou, Chen Lin, Xuanhe Zhou, Guoliang LiVLDB 2024 · 21 citations
  3. Experimental Analysis of Large-scale Learnable Vector Storage CompressionHailin Zhang, Penghao Zhao, Xupeng Miao, Yingxia Shao et al.VLDB 2024 · 20 citations
  4. Sample-Efficient Cardinality Estimation Using Geometric Deep LearningSilvan Reiner, Michael GrossniklausVLDB 2024 · 20 citations
  5. A Comparative Study and Component Analysis of Query Plan Representation Techniques in ML4DB StudiesYue Zhao, Zhaodonghui Li, Gao CongVLDB 2024 · 19 citations

Builds on8

  1. An End-to-End Learning-based Cost EstimatorJi Sun, Guoliang LiVLDB 2020 · 251 citations
  2. Bao: Making Learned Query Optimization PracticalRyan Marcus, Parimarjan Negi, Hongzi Mao, Nesime Tatbul et al.SIGMOD 2021 · 242 citations
  3. Reinforcement Learning with Tree-LSTM for Join Order SelectionXiang Yu, Guoliang Li, Chengliang Chai, Nan TangICDE 2020 · 168 citations
  4. Cost Models for Big Data Query Processing: Learning, Retrofitting, and Our FindingsTarique Siddiqui, Alekh Jindal, Shi Qiao, Hiren Patel et al.SIGMOD 2020 · 80 citations
  5. Automatic View Generation with Deep Learning and Reinforcement LearningHaitao Yuan, Guoliang Li, Ling Feng, Ji Sun et al.ICDE 2020 · 66 citations

Related papers

  1. PreQR: Pre-training Representation for SQL UnderstandingXiu Tang, Sai Wu, Mingli Song, Shanshan Ying et al.SIGMOD 2022 · 21 citations
  2. How Good are Learned Cost Models, Really? Insights from Query Optimization TasksRoman Heinrich, Manisha Luthra, Johannes Wehrstein, Harald Kornmayer et al.SIGMOD 2025 · 13 citations
  3. LEAP: A Low-cost Spark SQL Query Optimizer using Pairwise ComparisonJunhao Ye, Jiahui Li, Lu Chen, Yuren Mao et al.VLDB 2025 · 2 citations
  4. Reqo: A Comprehensive Learning-Based Cost Model for Robust and Explainable Query OptimizationBaoming Chang, Amin Kamali, Verena KantereSIGMOD 2026 · 1 citation
  5. A Resource-Aware Deep Cost Model for Big Data Query ProcessingYan Li, Liwei Wang, Sheng Wang, Yuan Sun et al.ICDE 2022 · 13 citations
Dusk over the sea between two cliffs drawn in fine vertical lines