Abstract
Modern analytical query engines (AQEs) are essential for large-scale data analysis and processing. These systems usually provide numerous query-level tunable knobs that significantly affect individual query performance. While several studies have explored automatic DBMS configuration tuning, they have several limitations to handle query-level tuning. Firstly, they fail to capture how knobs influence query plans, which directly affect query performance. Secondly, they overlook query failures during the tuning processing, resulting in low tuning efficiency. Thirdly, they struggle with cold-start problems for new queries, leading to prolonged tuning time. To address these challenges, we propose AQETuner, a novel Bayesian Optimization-based system tailored for reliable query-level knob tuning in AQEs. AQETuner first applies the attention mechanisms to jointly encode the knobs and plan query, effectively identifying the impact of knobs on plan nodes. Then, AQETuner employs a dual-task Neural Process to predict both query performance and failures, leveraging their interactions to guide the tuning process. Furthermore, AQETuner utilizes Particle Swarm Optimization to efficiently generate high-quality samples in parallel during the initial tuning stage for the new queries. Experimental results show that AQETuner significantly outperforms existing methods, reducing query latency by up to 23.7% and query failures by up to 51.2%.
Introduction: The Shift to Query-Level Tuning
Modern Analytical Query Engines (AQEs) like Presto, Snowflake, and ByteHouse are the workhorses of big data. However, their performance is highly sensitive to hundreds of tunable "knobs"—configurations for memory allocation, parallelism, and execution strategies. Traditionally, Database Administrators (DBAs) tuned these manually, or researchers used machine learning to optimize system-level knobs (e.g., total buffer pool size).
As shown in Figure 1, modern AQEs have seen a dramatic shift toward query-level knobs, which allow for fine-grained control over individual executions. This shift introduces new challenges: tuning is inherently risky, as aggressive settings often lead to query failures such as out-of-memory errors or timeouts. Most existing tuners ignore these failures or treat them simply as high-latency events, losing critical diagnostic information.
The AQETuner Architecture
AQETuner addresses the limitations of existing DBMS tuners through a three-pronged architecture designed for reliability and efficiency.
1. Knob-Plan Encoder
Existing tuners often ignore the query plan, failing to account for how a specific knob (e.g., join parallelism) interacts with specific operators. AQETuner uses Attention Mechanisms and "Hierarchical Spectral Positional Encoding" (HSPE) to capture the complex tree structure of query plans. As illustrated in Figure 2, analytical queries (like TPC-DS) are significantly more complex than standard OLTP queries (like TPC-C), requiring a model that understands the relationship between knobs and deep tree nodes.
2. Dual-Task Neural Process (DTP)
AQETuner treats failures as primary signals rather than noise. Its "brain" is a dual-task model that simultaneously predicts query latency and reliability (failure probability). By sharing information between these tasks via a gating mechanism, the model learns to identify "high-risk" zones where configurations might be fast but unstable.
3. PSO-based Warm Starter
To overcome the "cold-start" problem for new queries, AQETuner replaces traditional random sampling with Particle Swarm Optimization (PSO). This allows the system to explore the configuration space in parallel and gravitate toward promising regions much faster than sequential methods.
Experimental Evaluation
AQETuner was evaluated on ByteHouse and Presto using industry-standard benchmarks (TPC-DS, TPC-H) and real-world-inspired datasets (STATS-Analytical, JOB-Extend).
- Performance: AQETuner achieved up to a 23.7% reduction in average latency compared to other query-level tuners and a 37.5% improvement over system-level tuners like ResTune.
- Reliability: The system reduced query failures by 51.2% on complex workloads, demonstrating the effectiveness of its dual-task reliability modeling.
- Efficiency: The PSO-based warm starter gathered high-quality data 20.6% faster than random sampling and 68.9% faster than Genetic Algorithms.
Conclusion and Future Work
AQETuner demonstrates that reliable query-level tuning requires a deep understanding of query plans and an explicit modeling of failure risks. While the system significantly outperforms state-of-the-art methods, future work will focus on scaling to even larger query plans (beyond 100 nodes) and automating the initial selection of which knobs are most impactful for specific engines.
Summary updated