NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Lightweight Graphical Models for Selectivity Estimation Without Independence Assumptions

Kostas Tzoumas, Amol Deshpande, Christian S. JensenPVLDB 2011

Introduction

Query optimization is a critical component of modern database management systems (DBMS). To select an efficient execution plan, optimizers must accurately estimate the "selectivity"—the number of rows returned—of intermediate query steps. Since the 1970s, these estimations have relied on three primary simplifying assumptions: uniformity of data distribution, attribute value independence (AVI), and join predicate independence (JPI).

While 1D histograms have largely addressed the uniformity issue, the independence assumptions remain a significant bottleneck. In real-world datasets, attributes are often highly correlated (e.g., a car's 'make' and 'model'). When these correlations are ignored, the optimizer multiplies independent probabilities, leading to exponential error propagation. This often results in disastrously slow query plans, such as selecting nested-loop joins for massive intermediate tables that the optimizer incorrectly predicted would be small.

Methodology

This paper proposes a lightweight probabilistic graphical model (PGM) framework to capture attribute correlations without the prohibitive overhead of multi-dimensional histograms. The core approach involves modeling the database's joint probability distribution using Bayesian Networks, which are then compiled into Junction Trees for efficient inference.

Transformation from schema graph to junction tree: (a) Schema graph, (b) Bayesian network, (c) Moral graph, and (d) Junction tree.

To ensure the model remains computationally feasible within a DBMS, the authors introduce several key constraints:

  • Join Indicators: Joins are represented as binary random variables. This allows the model to bridge attributes across different tables without materializing a massive universal relation.
  • Restricted Structure: Attribute dependencies within a table are limited to a directed tree structure. Furthermore, join indicators are restricted to having at most two parents, ensuring that the resulting junction tree cliques remain small.
  • Efficient Inference: During optimization, the system extracts a minimal sub-tree relevant to the query and employs a message-passing algorithm. A dynamic programming approach is used to cache intermediate distributions, keeping latency within the millisecond range required for real-time query planning.

Experimental Evaluation

The proposed model was implemented directly within PostgreSQL and evaluated using two primary datasets:

  1. Modified TPC-H: A synthetic benchmark where data was injected with strong pairwise correlations (Zipf factor of 3, Pearson correlation of 0.9) to simulate real-world skew.
  2. IMDB (JOB): A real-world dataset containing complex, inherent correlations between movie genres, actors, and production years.

Results and Discussion

The experimental results demonstrate that the graphical model significantly outperforms standard PostgreSQL estimation techniques in both accuracy and resulting plan quality.

Performance comparison across TPC-H and IMDB workloads: (a) Optimizer cost (intermediate tuples), (b) Execution time, and (c) Selectivity estimation latency.

Execution and Accuracy

By correcting for missed correlations, the PGM-informed optimizer consistently chose superior plans. In one notable TPC-H case, the default PostgreSQL plan took over 40 minutes to execute due to an inappropriate nested-loop join. The PGM-informed plan completed in under 2 seconds. Across a workload of 400 queries, the model achieved up to a 10x reduction in average multiplicative error for complex joins.

Overhead and Scalability

Despite its accuracy, the model remains lightweight. It requires only approximately 100KB of storage in the PostgreSQL catalog. While offline model construction can take up to an hour, the online selectivity estimation latency is strictly maintained between 10 and 30 milliseconds, as shown in Figure 6(c). This confirms that PGMs can be integrated into production environments without compromising optimization speed.

Conclusion

This research proves that lightweight graphical models can effectively replace flawed independence assumptions in database optimizers. By using join indicators and restricted tree structures, the system captures vital correlations while maintaining low storage and computational overhead. Future work will focus on adapting the model for incremental updates to handle dynamic data changes and exploring more sophisticated histogram structures for low-dimensional correlated data.

Summary updated

BibTeX
@article{tzoumas2011lightweight,
  author = {Kostas Tzoumas and Amol Deshpande and Christian S. Jensen},
  title = {{Lightweight Graphical Models for Selectivity Estimation Without Independence Assumptions}},
  journal = {Proc. VLDB Endow.},
  year = {2011},
  url = {https://openreview.net/forum?id=L5RkYgIxP2},
}
Figure