Skip to main content
QUICK REVIEW

[Paper Review] FLAT: Fast, Lightweight and Accurate Method for Cardinality Estimation.

Rong Zhu, Zi‐Niu Wu|arXiv (Cornell University)|Jan 1, 2020
Data Management and AlgorithmsComputer Science43 references2 citations
TL;DR

FLAT is a fast, lightweight, and accurate cardinality estimation method that uses a novel unsupervised graphical model called FSPN, combining independent and conditional factorization to adaptively model attribute correlations. It enables near-linear time probability computation, reduces storage by 1–2 orders of magnitude, and improves query optimization accuracy by 1–5 orders of magnitude over existing methods, achieving 12.9% faster query execution in Postgres compared to baseline.

ABSTRACT

Query optimizers rely on accurate cardinality estimation (CardEst) to produce good execution plans. The core problem of CardEst is how to model the rich joint distribution of attributes in an accurate and compact manner. Despite decades of research, existing methods either over simplify the models only using independent factorization which leads to inaccurate estimates, or over complicate them by lossless conditional factorization without any independent assumption which results in slow probability computation. In this paper, we propose FLAT, a CardEst method that is simultaneously fast in probability computation, lightweight in model size and accurate in estimation quality. The key idea of FLAT is a novel unsupervised graphical model, called FSPN. It utilizes both independent and conditional factorization to adaptively model different levels of attributes correlations, and thus dovetails their advantages. FLAT supports efficient online probability computation in near liner time on the underlying FSPN model, provides effective offline model construction and enables incremental model updates. It can estimate cardinality for both single table queries and multi table join queries. Extensive experimental study demonstrates the superiority of FLAT over existing CardEst methods on well known IMDB benchmarks: FLAT achieves 1 to 5 orders of magnitude better accuracy, 1 to 3 orders of magnitude faster probability computation speed and 1 to 2 orders of magnitude lower storage cost. We also integrate FLAT into Postgres to perform an end to end test. It improves the query execution time by 12.9% on the benchmark workload, which is very close to the optimal result 14.2% using the true cardinality.

Motivation & Objective

  • To address the trade-off between model accuracy, computation speed, and storage cost in cardinality estimation.
  • To develop a method that efficiently models complex attribute correlations without relying solely on independence or lossless conditional factorization.
  • To enable fast online probability computation and incremental model updates for dynamic databases.
  • To support both single-table and multi-table join queries with high estimation accuracy.
  • To integrate into real database systems and demonstrate end-to-end performance gains.

Proposed method

  • FLAT introduces FSPN, a novel unsupervised graphical model that combines independent and conditional factorization to adaptively capture varying levels of attribute correlation.
  • It uses a hybrid factorization strategy: independent for weakly correlated attributes and conditional for strongly correlated ones, balancing accuracy and efficiency.
  • The model supports near-linear time probability computation through optimized inference algorithms on the FSPN structure.
  • Offline model construction is performed using unsupervised learning on database statistics, enabling efficient initialization.
  • Incremental updates are supported to adapt the model to schema or data changes without full retraining.
  • The method is integrated into Postgres for end-to-end evaluation, demonstrating practical deployment viability.

Experimental results

Research questions

  • RQ1Can a hybrid factorization model combining independence and conditional factorization achieve better accuracy than purely independent or fully conditional models?
  • RQ2Can such a model maintain fast probability computation while reducing storage overhead?
  • RQ3How does the method scale in terms of accuracy, speed, and memory usage across diverse query workloads?
  • RQ4To what extent can FLAT improve query execution time when integrated into a real DBMS like Postgres?
  • RQ5How does it compare to ground truth cardinality in terms of optimization quality?

Key findings

  • FLAT achieves 1 to 5 orders of magnitude better cardinality estimation accuracy than existing methods on IMDB benchmarks.
  • It reduces probability computation time by 1 to 3 orders of magnitude compared to prior approaches.
  • Storage costs are reduced by 1 to 2 orders of magnitude, making the model lightweight.
  • When integrated into Postgres, FLAT improves query execution time by 12.9%, close to the optimal 14.2% using true cardinality.
  • The method supports both single-table and multi-table join queries with consistent performance gains.
  • Incremental updates allow the model to adapt efficiently to data and schema changes without retraining from scratch.

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.