RSSAmplifier

boringSQL | Supercharge your SQL & PostgreSQL powers · Feb 26, 2026

PostgreSQL Statistics: Why queries run slow

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

Every query starts with a plan, and a slow query is usually the result of a bad one. More often than not, stale statistics are to blame. But how does it really work? PostgreSQL doesn't run the query to find out - it estimates the cost. It reads pre-computed data from pg_class and pg_statistic and does the maths to figure out the cheapest path to your data. In ideal scenario, the numbers read…

Read on boringsql.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.