Skip to main content
QUICK REVIEW

[Paper Review] BayesCard: A Unified Bayesian Framework for Cardinality Estimation.

Zi‐Niu Wu, Amir Shaikhha|arXiv (Cornell University)|Dec 29, 2020
Bayesian Modeling and Causal InferenceComputer Science37 references6 citations
TL;DR

BayesCard introduces a unified Bayesian framework using probabilistic programming languages (PPLs) to build compact, interpretable Bayesian Networks (BNs) for cardinality estimation in databases. It achieves state-of-the-art accuracy with up to 1,000x smaller model sizes and 10–100x lower training costs than deep learning models, while maintaining stable and interpretable performance for query optimizers.

ABSTRACT

Cardinality estimation is one of the fundamental problems in database management systems and it is an essential component in query optimizers. Traditional machine-learning-based approaches use probabilistic models such as Bayesian Networks (BNs) to learn joint distributions on data. Recent research advocates for using deep unsupervised learning and achieves state-of-the-art performance in estimating the cardinality of selection and join queries. Yet the lack of scalability, stability and interpretability of such deep learning models, makes them unsuitable for real-world databases. Recent advances in probabilistic programming languages (PPLs) allow for a declarative and efficient specification of probabilistic models such as BNs, and achieve state-of-the-art accuracy in various machine learning tasks. In this paper, we present BayesCard, the first framework incorporating the techniques behind PPLs for building BNs along with relational extensions that can accurately estimate the cardinality of selection and join queries in database systems with model sizes that are up to three orders of magnitude smaller than deep models'. Furthermore, the more stable performance and better interpretation of BNs make them viable options for practical query optimizers. Our experimental results on several single-relation and multi-relation databases indicate that BayesCard with a reasonable estimation time has a better estimation accuracy than deep learning models, and has from one to two orders of magnitude less training cost nevertheless.

Motivation & Objective

  • Address the limitations of deep learning models in cardinality estimation, including poor scalability, instability, and lack of interpretability.
  • Improve the accuracy and efficiency of cardinality estimation in database query optimizers for both selection and join queries.
  • Leverage probabilistic programming languages (PPLs) to enable declarative, efficient, and scalable construction of Bayesian Networks (BNs).
  • Reduce model size and training cost while maintaining or improving estimation accuracy compared to state-of-the-art deep learning approaches.
  • Enable practical deployment of probabilistic models in real-world database systems through enhanced stability and interpretability.

Proposed method

  • Utilizes probabilistic programming languages (PPLs) to declaratively specify Bayesian Networks (BNs) for modeling joint data distributions.
  • Applies relational extensions to BNs to support cardinality estimation across multiple relations, including join queries.
  • Employs efficient inference and learning algorithms native to PPLs to scale BNs to realistic database sizes.
  • Optimizes model structure and parameters using data-driven learning while preserving interpretability.
  • Introduces a unified framework that supports both single-relation and multi-relation cardinality estimation.
  • Reduces model size by leveraging structured priors and compact parameterization enabled by PPLs, achieving up to 3 orders of magnitude smaller models than deep learning alternatives.

Experimental results

Research questions

  • RQ1Can a Bayesian framework built with probabilistic programming languages achieve higher accuracy than deep learning models in cardinality estimation?
  • RQ2To what extent can Bayesian Networks reduce model size and training cost while maintaining or improving estimation accuracy?
  • RQ3How does the interpretability and stability of Bayesian Networks compare to deep learning models in practical database query optimization?
  • RQ4Can relational extensions to Bayesian Networks effectively model complex join cardinalities across multiple tables?
  • RQ5What is the trade-off between model size, training cost, and estimation accuracy when using PPL-based BNs versus deep learning models?

Key findings

  • BayesCard achieves state-of-the-art estimation accuracy on both single-relation and multi-relation databases, outperforming deep learning models.
  • The framework reduces model size by up to three orders of magnitude compared to deep learning models, enabling efficient deployment.
  • BayesCard exhibits 1 to 2 orders of magnitude lower training cost than deep learning baselines, making it more efficient to train.
  • The method maintains stable performance across diverse data distributions, demonstrating robustness compared to unstable deep learning counterparts.
  • The use of PPLs enables compact, interpretable models that are suitable for integration into real-world query optimizers.
  • BayesCard delivers high-accuracy cardinality estimates with reasonable inference time, making it practical for online query optimization.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.