CONCERTO: Complex Query Execution Mechanism-Aware Learned Cost Estimation

Kaixin Zhang, Hongzhi Wang, K Gu, Ziqi Li, Chunyu Zhao, Yingze Li, Yu Yan · DOI

Abstract

With the growing demand for massive data analysis, many DBMSs have adopted complex underlying query execution mechanisms, including vectorized operators, parallel execution, and dynamic pipeline modifications. However, there remains a lack of targeted Query Performance Prediction (QPP) methods for these complex execution mechanisms and their interactions, as most existing approaches focus on traditional tree-shaped query plans and static serial executors. To address this challenge, this paper proposes CONCERTO, a Complex query executiON meChanism-awaE leaRned cosT estimatiOn method. CONCERTO first establishes independent resource cost models for each physical operator. It then constructs a Directed Acyclic Graph (DAG) consisting of a dataflow tree backbone and resource competition relationships among concurrent operators. After calibrating the cost impact of parallel operator execution using Graph Attention Networks (GATs) with additional attention mechanisms, CONCERTO extracts and aggregates cost vector trees through Temporal Convolutional Networks (TCNs), ultimately achieving effective query performance prediction. Experimental results demonstrate that CONCERTO achieves higher prediction accuracy than existing methods.

Introduction

Predicting query latency—known as Query Performance Prediction (QPP)—is a cornerstone of modern database management, enabling effective admission control, resource scheduling, and query optimization. However, the architecture of modern Online Analytical Processing (OLAP) engines like ClickHouse and DuckDB has evolved beyond the capabilities of traditional QPP models.

Modern engines utilize complex execution mechanisms that violate the assumptions of serial, tree-based models. These include SIMD vectorization for batch processing, parallel Directed Acyclic Graph (DAG) pipelines where operators compete for hardware resources, and Adaptive Query Execution (AQE) where plans are modified at runtime. Existing methods often fail to capture the "resource competition" inherent in these parallel environments, leading to significant prediction inaccuracies.

The CONCERTO Framework

To bridge this gap, the authors developed CONCERTO, a multi-stage learned cost estimator designed to account for the nuances of high-performance OLAP execution. The framework decouples the base cost of an operator from the interference caused by concurrent execution.

The three-stage CONCERTO framework, integrating runtime tracking, operator cost prediction, and graph-based calibration.

CONCERTO operates in three distinct stages:

  1. Operator Cost Prediction (OCP): Lightweight Multi-Layer Perceptrons (MLPs) predict the "isolated" cost (CPU, memory, and I/O) of individual vectorized operators. This ensures the model understands the fundamental resource requirements of a scan or join before considering system-wide noise.
  2. Cost Calibration: This stage addresses resource competition. CONCERTO constructs a graph representing both the data flow and the competition relationships between concurrent operators. A Graph Attention Network (GAT) with a custom attention mechanism learns how much one operator (e.g., a CPU-intensive Join) slows down another (e.g., a Sort) when they share hardware resources.
  3. Query Performance Prediction: The calibrated costs are structured into a vector tree. A Temporal Convolutional Network (TCN) then aggregates these costs from the bottom up to generate the final latency prediction.

A critical component of this system is the Runtime Tracker. Unlike models that rely on static EXPLAIN plans, CONCERTO uses a "probe execution mode" that runs the first few chunks of a query. This captures real-world resource pressure and dynamic plan modifications that a static planner cannot foresee.

Operator Resource Profiles

A key insight of the CONCERTO approach is that different operators exert vastly different pressures on system resources. By modeling these costs independently, the system achieves higher generalization across diverse query structures.

Relative cost ranking of various database operators across IO, Memory, and CPU resources, highlighting the need for multi-dimensional cost modeling.

As shown in the relative cost rankings, an operator that is expensive in terms of I/O (like a MergeTreeSink) may not be the most expensive in terms of CPU (where ConvertAggToChunks often dominates). CONCERTO's ability to decouple these dimensions allows it to accurately calibrate interference in complex parallel pipelines.

Experimental Evaluation

The model was evaluated using TPC-H and TPC-DS benchmarks on a ClickHouse implementation. CONCERTO was compared against state-of-the-art baselines including QPPNet, QueryFormer, and RAAL.

  • Accuracy: On the complex TPC-DS benchmark, CONCERTO achieved a mean Q-Error of 1.84, outperforming RAAL (2.00) and QueryFormer (2.59). It also significantly reduced "tail latency" errors, showing higher robustness on complex queries.
  • Efficiency: Despite its multi-stage architecture, CONCERTO maintains a tiny model footprint (0.094 MB) and lightning-fast inference times (4.2 ms). This makes it nearly 75x faster than QPPNet, rendering it highly practical for real-time database environments.

Conclusion

CONCERTO demonstrates that accounting for complex execution mechanisms—specifically parallel resource competition and dynamic plan modifications—is essential for accurate QPP in modern OLAP engines. While the current model is sensitive to cardinality estimation errors, its modular design and efficient inference provide a strong foundation for future cross-DBMS cost estimation plugins. Future work will focus on extending the probe phase to capture mid-execution shifts in system load.

Summary updated

BibTeX
@misc{zhang2024concerto,
  author = {Kaixin Zhang and Hongzhi Wang and K Gu and Ziqi Li and Chunyu Zhao and Yingze Li and Yu Yan},
  title = {{CONCERTO: Complex Query Execution Mechanism-Aware Learned Cost Estimation}},
  year = {2024},
  eprint = {2412.00749},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.00749},
}
Figure