Skip to main content
QUICK REVIEW

[Paper Review] Robust Estimation of Resource Consumption for SQL Queries using Statistical Techniques

Jiexing Li, Arnd Christian König|arXiv (Cornell University)|Aug 1, 2012
Advanced Database Systems and QueriesComputer Science16 references3 citations
TL;DR

This paper proposes a robust statistical approach for estimating SQL query resource consumption by modeling individual query operators with specialized regression trees and scaling functions, achieving significantly higher accuracy than traditional cost models—even for novel or out-of-distribution query plans—demonstrated on real-world and benchmark workloads in Microsoft SQL Server.

ABSTRACT

The ability to estimate resource consumption of SQL queries is crucial for a number of tasks in a database system such as admission control, query scheduling and costing during query optimization. Recent work has explored the use of statistical techniques for resource estimation in place of the manually constructed cost models used in query optimization. Such techniques, which require as training data examples of resource usage in queries, offer the promise of superior estimation accuracy since they can account for factors such as hardware characteristics of the system or bias in cardinality estimates. However, the proposed approaches lack robustness in that they do not generalize well to queries that are different from the training examples, resulting in significant estimation errors. Our approach aims to address this problem by combining knowledge of database query processing with statistical models. We model resource-usage at the level of individual operators, with different models and features for each operator type, and explicitly model the asymptotic behavior of each operator. This results in significantly better estimation accuracy and the ability to estimate resource usage of arbitrary plans, even when they are very different from the training instances. We validate our approach using various large scale real-life and benchmark workloads on Microsoft SQL Server.

Motivation & Objective

  • To address the poor generalization of existing statistical resource estimation models on unseen or out-of-distribution query plans.
  • To improve estimation accuracy beyond traditional handcrafted cost models that fail to capture hardware-specific behaviors and query processing optimizations.
  • To enable accurate resource estimation for arbitrary query plans, even when they differ significantly from training examples.
  • To ensure low runtime overhead and compact model storage for practical deployment in database systems.

Proposed method

  • Models resource consumption at the individual operator level, with distinct regression models and features for each operator type.
  • Employs regression trees (specifically MART) to learn complex, non-linear relationships between query features and resource usage.
  • Introduces scaling functions to handle feature values far outside the training distribution, ensuring robustness to data size and selectivity changes.
  • Explicitly models the asymptotic behavior of each operator to improve extrapolation to novel plans.
  • Uses boosting (MART) with up to 1,000 iterations to train accurate, compact models.
  • Encodes models efficiently (up to 127KB for 1K trees) with minimal memory footprint, enabling deployment in production systems.

Experimental results

Research questions

  • RQ1Can statistical models trained on query features outperform traditional cost models in estimating CPU, memory, and I/O usage?
  • RQ2How well can statistical models generalize to query plans that differ significantly from training examples?
  • RQ3Can scaling functions improve estimation robustness when feature values (e.g., selectivity, data size) are far outside the training range?
  • RQ4What is the runtime and storage overhead of deploying such models in a real database system?
  • RQ5Can models trained on synthetic or benchmark data generalize effectively to real-life decision support workloads?

Key findings

  • The proposed method reduced estimation error significantly compared to traditional cost models, even when cardinality estimates were accurate.
  • On TPC-H workloads with skewed data, the statistical model achieved much closer alignment between estimated and actual CPU times than the optimizer’s built-in cost model.
  • Training times remained low (under 37 seconds for 160K examples), with the main cost being query execution, not model training.
  • Model inference incurred only ~0.5 µs per call, which is negligible compared to typical query optimization times (>50 ms).
  • Model size was compact (up to 127KB), making it feasible to store and deploy across multiple operators and workloads.
  • The approach generalized well to unseen query plans and data distributions, demonstrating robustness through scaling functions and operator-level modeling.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.