PostgreSQL & Databases
Planner statistics
Planner statistics are sampled estimates that ANALYZE stores per column, and the planner uses them to pick plans. You learn to compare estimates with real counts and to refresh stale statistics.
What you will be able to do
- Explain where planner row estimates come from, and why they can be wrong.
- Decide when to run ANALYZE, and when to add extended statistics.
What is in the lesson
- A real situation where this goes wrong
- How it works, step by step
- A walkthrough with commands you can run
- How it fails in production, and how to tell
- Three quiz questions with explanations
Read this lessonFree. No account needed.
More in PostgreSQL & Databases
- Index only scansIntermediate · 4 min
An index-only scan answers from the index, but it still visits the heap for pages the visibility map has not marked all-visible. You learn to read Heap Fetches, and…
- EXPLAIN ANALYZE BUFFERSAdvanced · 4 min
EXPLAIN ANALYZE with BUFFERS shows how many pages each plan node reads from cache and from outside it. You learn to read the hit, read and temp counts before judging a…
- WAL fundamentalsAdvanced · 4 min
WAL records each change before the data page is written, so a crash is repaired by replaying the log. You learn why a commit waits for the log flush, and why fsync must…
- Replication slotsAdvanced · 4 min
A replication slot makes the primary keep WAL until a consumer has received it. You learn how an inactive slot fills the disk, and how to measure it and drop it safely.
- Streaming replicasAdvanced · 4 min
A streaming replica replays WAL from the primary and can serve read-only queries, but it trails the primary and can cancel queries. You learn to check lag and conflicts…
- PITR with pgBackRestAdvanced · 5 min
Point-in-time recovery rebuilds a database to a chosen moment from a base backup and archived WAL. A restore is only as good as the archive that covers the target time.