[Paper Review] Multi-Attribute Selectivity Estimation Using Deep Learning
This paper proposes two deep learning-based approaches for multi-attribute selectivity estimation: one framed as unsupervised neural density estimation using autoregressive flows, and another as supervised learning using query features and true selectivity labels. Both methods achieve high accuracy with low space overhead, significantly outperforming traditional histogram and sampling techniques, especially for complex, high-cardinality, or low-selectivity queries.
Selectivity estimation - the problem of estimating the result size of queries - is a fundamental problem in databases. Accurate estimation of query selectivity involving multiple correlated attributes is especially challenging. Poor cardinality estimates could result in the selection of bad plans by the query optimizer. We investigate the feasibility of using deep learning based approaches for both point and range queries and propose two complementary approaches. Our first approach considers selectivity as an unsupervised deep density estimation problem. We successfully introduce techniques from neural density estimation for this purpose. The key idea is to decompose the joint distribution into a set of tractable conditional probability distributions such that they satisfy the autoregressive property. Our second approach formulates selectivity estimation as a supervised deep learning problem that predicts the selectivity of a given query. We also introduce and address a number of practical challenges arising when adapting deep learning for relational data. These include query/data featurization, incorporating query workload information in a deep learning framework and the dynamic scenario where both data and workload queries could be updated. Our extensive experiments with a special emphasis on queries with a large number of predicates and/or small result sizes demonstrates that our proposed techniques provide fast and accurate selective estimates with minimal space overhead.
Motivation & Objective
- To address the challenge of accurate selectivity estimation in databases when multiple correlated attributes are involved.
- To explore whether deep learning can effectively model complex, non-linear correlations between attributes in relational data.
- To design lightweight, fast, and scalable deep learning models suitable for dynamic database workloads with incremental data and query updates.
- To integrate domain knowledge such as functional dependencies and query workload patterns into deep learning models for improved estimation.
- To evaluate the performance of deep learning models on real-world datasets with high-dimensional, correlated attributes and complex query workloads.
Proposed method
- Formulates selectivity estimation as an unsupervised deep density estimation problem using autoregressive flows to decompose the joint distribution into tractable conditional probabilities.
- Employs a single deep neural network to learn parameters for each conditional distribution, leveraging the autoregressive property to model dependencies across attributes.
- Introduces a mixture of models with multiple random attribute orderings to reduce sensitivity to ordering and improve generalization.
- For supervised learning, constructs a deep learning model trained on query features and true selectivity values extracted from query logs.
- Uses query featurization techniques including one-hot and binary encoding, with empirical validation showing binary encoding performs better on high-cardinality domains.
- Incorporates domain knowledge such as functional dependencies to filter and guide attribute orderings, improving model accuracy.
Experimental results
Research questions
- RQ1Can deep learning effectively model complex, multi-attribute correlations in relational data for selectivity estimation?
- RQ2How does the autoregressive structure in neural density estimation improve accuracy compared to traditional histogram or sampling methods?
- RQ3To what extent can supervised deep learning models trained on query logs generalize to unseen queries with high-dimensional predicates?
- RQ4How do different data encoding schemes (one-hot vs. binary) affect model performance on high-cardinality attributes?
- RQ5Can injecting domain knowledge such as functional dependencies improve the robustness and accuracy of deep learning-based selectivity estimators?
Key findings
- The unsupervised deep density estimation approach achieves high accuracy by modeling the joint distribution through autoregressive flows, reducing error in multi-attribute queries.
- The supervised deep learning model achieves a median q-error of less than 2 even for queries with selectivity below 1%, demonstrating strong generalization on low-selectivity cases.
- Binary encoding of attributes outperforms one-hot encoding on high-cardinality datasets like IMDB, especially when domain cardinalities reach tens of thousands.
- Using 1 to 5 random attribute orderings in the mixture model yields optimal performance, as higher values increase the risk of poor orderings.
- Filtering attribute orderings using functional dependencies leads to a non-negligible improvement in estimation accuracy, validating the value of incorporating domain knowledge.
- The supervised model trained with q-error as the loss function significantly outperforms models using MSE, confirming that direct optimization of q-error leads to better practical results.
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.