The document presents a technique for selectivity estimation in query optimization without assuming independence between attributes. It uses lightweight graphical models, specifically a junction tree, to capture correlations and approximate the joint probability distribution over relevant variables. This avoids the independence assumptions made by traditional optimizers that can lead to errors in cardinality estimates and suboptimal query plans. The graphical models are implemented within PostgreSQL to provide selectivity estimates with an order of magnitude better accuracy compared to the default PostgreSQL estimates, while keeping optimization time low.