[Paper Review] An Empirical Analysis of Deep Learning for Cardinality Estimation
This paper evaluates deep learning models for cardinality estimation in database query optimization, demonstrating that simple neural networks reduce estimation error by up to 98% compared to PostgreSQL. When integrated into the optimizer, these models improve query plan selection, reducing runtime by up to 49% on complex workloads.
We implement and evaluate deep learning for cardinality estimation by studying the accuracy, space and time trade-offs across several architectures. We find that simple deep learning models can learn cardinality estimations across a variety of datasets (reducing the error by 72% - 98% on average compared to PostgreSQL). In addition, we empirically evaluate the impact of injecting cardinality estimates produced by deep learning models into the PostgreSQL optimizer. In many cases, the estimates from these models lead to better query plans across all datasets, reducing the runtimes by up to 49% on select-project-join workloads. As promising as these models are, we also discuss and address some of the challenges of using them in practice.
Motivation & Objective
- To evaluate the feasibility and performance of deep learning models for cardinality estimation in relational databases.
- To compare deep learning models with traditional statistics and tree ensembles in terms of accuracy, training time, and model size.
- To assess the impact of learned cardinality estimates on actual query execution plans and runtime performance.
- To investigate the robustness of models under changing query workloads and the interpretability of learned representations.
- To address practical challenges such as training overhead, generalization, and integration into existing database systems.
Proposed method
- Implement and train various deep neural network (DNN) and recurrent neural network (RNN) architectures for cardinality estimation on real-world datasets.
- Use a supervised learning approach where models are trained on labeled query subplans with ground-truth cardinalities.
- Vary model complexity by adjusting depth and width to study trade-offs between accuracy, inference time, and parameter count.
- Integrate trained deep learning models into PostgreSQL’s query optimizer to evaluate their impact on actual query execution plans.
- Apply active learning techniques (e.g., uncertainty sampling, query-by-committee) to reduce the number of training samples needed.
- Visualize learned embeddings to analyze what features the models capture during training.
Experimental results
Research questions
- RQ1Can simple deep learning models significantly improve cardinality estimation accuracy compared to traditional DBMS statistics?
- RQ2What are the space, time, and accuracy trade-offs of different deep learning architectures in cardinality estimation?
- RQ3How do deep learning models compare to tree ensembles and PostgreSQL’s built-in estimator in terms of prediction accuracy and training overhead?
- RQ4To what extent do deep learning-based estimates improve actual query execution performance when injected into the optimizer?
- RQ5How robust are deep learning models to changes in query workload distribution?
Key findings
- Simple deep learning models reduce cardinality estimation error by 72% to 98% on average compared to PostgreSQL’s default estimator.
- When integrated into PostgreSQL’s optimizer, deep learning models reduce query runtime by up to 49% on select-project-join workloads.
- Tree ensembles generally train faster and are more accurate than deep learning models under certain conditions, despite requiring more storage.
- Deep learning models show better robustness to workload shifts than tree ensembles, which are more sensitive to distributional changes.
- Active learning techniques like QBC and QBC+Clustering reduce the number of required training samples, achieving low loss with small datasets.
- Visualizations of learned embeddings reveal that models capture meaningful data correlations and distributional patterns beyond basic statistics.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.