pg_stats: How Postgres Internal Stats Work

Introduction I recently had the privilege of speaking at POSETTE 2026 about pg_stats and how Postgres internal statistics work ( YouTube Recording ). This post is a written companion to that talk – aimed at giving you a working understanding of what pg_stats is, how it’s populated, and how it shapes the decisions the query planner makes on your behalf. Imagine a customers table that looks roughly…