Lune

VLDB2022Top-tier venue

Leveraging Query Logs and Machine Learning for Parametric Query Optimization

Kapil Vaidya, Anshuman Dutt, Vivek R. Narasayya, Surajit Chaudhuri

Abstract

Parametric query optimization (PQO) must address two problems: identify a relatively small number of plans to cache for a parameterized query (populateCache), and efficiently select the best cached plan to use for executing any instance of the parameterized query (getPlan). Our approach decouples these two decisions. We formulate populateCache as an optimization problem with the goal of identifying a set of plans that minimizes the optimizer estimated cost of queries in the log, and present an efficient algorithm. For getPlan, we leverage query logs to train machine learning (ML) models to choose the lowest optimizer-estimated cost plan from the cached plans. We conduct extensive experiments using complex parameterized queries from benchmarks and real workloads. Our algorithm for populateCache achieves low geometric mean sub-optimality (1.2) even for complex queries using relatively few plans, and scales well to large query logs. The mean latency of our ML model based getPlan technique ( 210μ sec ) is between one to four orders of magnitude faster compared to prior PQO techniques. The mean sub-optimality is low (1.05), and the 95 th percentile sub-optimality (1.3) is between 1.1× and 25× lower compared to prior techniques. Finally, we present an efficient algorithm for getPlan that leverages execution time information in query logs to circumvent inaccuracies of the query optimizer's cost estimates.

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.

6 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

  • TRAP: Tailored Robustness Assessment for Index Advisors via Adversarial Perturbation cites Bao: Making Learned Query Optimization Practical
  • The Holon Approach for Simultaneously Tuning Multiple Components in a Self-Driving Database Management System with Machine Learning via Synthesized Proto-Actions cites Fine-Grained Modeling and Optimization for Intelligent Resource Management in Big Data Processing
  • The Holon Approach for Simultaneously Tuning Multiple Components in a Self-Driving Database Management System with Machine Learning via Synthesized Proto-Actions cites Bao: Making Learned Query Optimization Practical
  • RankPQO: Learning-to-Rank for Parametric Query Optimization cites Bao: Making Learned Query Optimization Practical
  • PAR2QO: Parametric Penalty-Aware Robust Query Optimization cites Bao: Making Learned Query Optimization Practical
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers6

  1. Fine-Grained Modeling and Optimization for Intelligent Resource Management in Big Data ProcessingChenghao Lyu, Qi Fan, Fei Song, Arnab Sinha et al.VLDB 2022 · 14 citations
  2. The Holon Approach for Simultaneously Tuning Multiple Components in a Self-Driving Database Management System with Machine Learning via Synthesized Proto-ActionsWilliam Zhang, Wan Shen Lim, Matthew Butrovich, Andrew PavloVLDB 2024 · 13 citations
  3. TRAP: Tailored Robustness Assessment for Index Advisors via Adversarial PerturbationWei Zhou, Chen Lin, Xuanhe Zhou, Guoliang Li et al.ICDE 2024 · 3 citations
  4. RankPQO: Learning-to-Rank for Parametric Query OptimizationSongsong Mo, Yue Zhao, Zhifeng Bao, Quanqing Xu et al.VLDB 2025 · 3 citations
  5. PAR2QO: Parametric Penalty-Aware Robust Query OptimizationHaibo Xiu, Yang Li, Qianyu Yang, Pankaj Agarwal et al.VLDB 2025 · 1 citation

Builds on2

  1. Bao: Making Learned Query Optimization PracticalRyan Marcus, Parimarjan Negi, Hongzi Mao, Nesime Tatbul et al.SIGMOD 2021 · 242 citations
  2. Efficiently Approximating Selectivity Functions using Low Overhead Regression ModelsAnshuman Dutt, Chi Wang, Vivek R. Narasayya, Surajit ChaudhuriVLDB 2020 · 45 citations

Related papers

  1. APQO: An Adaptive Framework for Parametric Query OptimizationSijia Li, Peng Cai, Zhifan Zhang, Huiqi Hu et al.SIGMOD 2026 · 2 citations
  2. Practical Parameterized Query Optimization via Efficient Plan Reuse and List-wise RankingHai Lan, Yang Yu, Zhifeng Bao, Zi Huang et al.SIGMOD 2026
  3. Kepler: Robust Learning for Parametric Query OptimizationLyric Doshi, Vincent Zhuang, Gaurav Jain, Ryan Marcus et al.SIGMOD 2023 · 35 citations
  4. Lero: A Learning-to-Rank Query OptimizerRong Zhu, Wei Chen, Bolin Ding, Xingguang Chen et al.VLDB 2023 · 102 citations
  5. 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
Dusk over the sea between two cliffs drawn in fine vertical lines