pg_stats: How Postgres Internal Stats Work
Why does Postgres sometimes choose a Sequential Scan over an Index Scan, even when it seems slower? The answer almost always lies in the statistics. The query planner relies on a mathematical model of your data distribution to make decisions, and when that model is wrong, performance suffers.
In this session, we will crack open the pg_stats view to understand exactly how Postgres "sees" your data. We will cover histograms, most common values (MCV), and correlation. We will also explore Extended Statistics, a powerful feature for fixing bad query plans on correlated columns (like City and State), ensuring your planner stops guessing and starts knowing.
Join the conversation
Use the hashtag #PosetteConf