Introduction
Modern Database Management Systems (DBMS) like PostgreSQL or MySQL feature hundreds of adjustable "knobs"—parameters such as memory limits, connection counts, and buffer sizes—that significantly impact performance. Finding the optimal configuration for a specific workload is a complex task typically reserved for expert Database Administrators (DBAs). While automated tuners using Bayesian Optimization (BO) or Reinforcement Learning (RL) have emerged, they are hindered by a major bottleneck: they are inherently iterative. These methods require replaying workloads hundreds of times to evaluate different configurations, a process that can take hours or even days.
E2ETune addresses this by reframing knob tuning as a sequence-to-sequence translation task. By fine-tuning a Large Language Model (LLM), E2ETune can directly predict optimal database configurations from workload features in a single shot, reducing tuning time by up to 98% while matching or exceeding the performance of state-of-the-art iterative tuners.
The E2ETune Framework
The E2ETune system operates in three main stages: training data construction, language model fine-tuning, and the final knob tuning process.
1. Training Data Construction
Training an end-to-end model requires a vast dataset of workload-configuration pairs. Since such data is scarce, the authors utilized GPT-4-Turbo to generate thousands of diverse synthetic Online Analytical Processing (OLAP) queries and randomized transaction weights for Online Transaction Processing (OLTP) workloads. To label these workloads with "optimal" configurations without the prohibitive cost of actual execution, they employed a lightweight machine learning cost model (Gradient Boosting + Random Forest). This model simulates database performance, allowing a traditional BO tuner (HEBO) to find high-quality configurations rapidly.
2. Fine-Tuning the Language Model
The core of E2ETune is a fine-tuned Mistral-7B model. The model is trained to map workload features—including statistics, query plans, and internal metrics—to configuration settings. A key innovation here is bucketing: instead of asking the LLM to predict exact continuous numerical values, the authors discretized knob ranges into 10 percentile buckets. The LLM then predicts the appropriate bucket for each knob.
3. Inference and Knob Tuning
For a new, unseen workload, E2ETune extracts features and prompts the fine-tuned LLM to sample candidate configurations. It typically samples eight candidates, which are then ranked using the previously trained cost model. The top-ranked configuration is then recommended and applied to the database.
Experimental Evaluation
The authors evaluated E2ETune across a diverse set of benchmarks, including 10 standard benchmarks (e.g., TPC-H, TPC-C, YCSB) and real-world workloads from StackOverflow and ByteDance internal systems (SSAG and AMPS).
Key Results
- Efficiency: E2ETune achieved a staggering reduction in tuning time, reaching up to 98.6%. On TPC-H, tuning time dropped from over 23 hours (with HEBO) to under 20 minutes.
- Performance: In "in-schema" tests, E2ETune outperformed traditional BO, RL, and other LLM-assisted methods like DB-BERT, securing the best or second-best configuration in 9 out of 10 benchmarks.
- Generalization: By incorporating SQL query plans into the input features, E2ETune demonstrated strong "cross-schema" generalization, effectively tuning databases it had never encountered during training.
Insights and Future Directions
A surprising finding was that E2ETune often outperformed its "teacher" (the HEBO tuner used for labeling). This is attributed to the LLM's sampling strategy, which allows for creative exploration beyond the strict training labels. Additionally, the move from raw regression to bucket-based classification was essential for the model's success.
Despite its strengths, E2ETune is currently limited by database engine lock-in. The model is specific to the engine it was trained on (e.g., PostgreSQL). Adapting to a different engine like MySQL requires generating a new dataset and retraining. Future work aims to integrate even more advanced optimization algorithms during the data collection phase to further enhance the quality of the training labels.
Summary updated