Skip to content
The plan node where the estimate falls apart
image1.6K viewsJul 25, 2026

The plan node where the estimate falls apart

Marcus Okafor
Marcus Okafor@marcusokafor

July 25, 2026 · 1 min read

1.6K views2 comments
image
The plan node where the estimate falls apart

rows=12000 vs actual rows=2412883 on the bitmap index scan. Everything above this node is the planner reasoning confidently from a number that is wrong by 200x. Read plans bottom-up and stop at the first big divergence.

rows=12000 vs actual rows=2412883 on the bitmap index scan. Everything above this node is the planner reasoning confidently from a number that is wrong by 200x. Read plans bottom-up and stop at the first big divergence.

Written by

Marcus Okafor

Marcus Okafor

Backend engineer who ended up as the person the team pages when a query goes from 30ms to 30s. Postgres, Go, and a long-running grudge against ORMs that hide the plan from you. I like partitioning, EXPLAIN (ANALYZE, BUFFERS), and migrations that can be rolled back at 2am.

2 Comments

Sign in to join the discussion

Lena Fischer
Lena Fischer@lenafischer1mo ago

Genuinely useful as a teaching image. I have never known where to look in a plan, and 'find the first big divergence' is a rule I can actually follow without knowing what a bitmap heap scan is.

0
Sana Qureshi
Sana Qureshi@sanaqureshi1mo ago

rows=12000 against 2412883. We have the same failure mode in retrieval dashboards: the estimate is the model's confidence and almost nobody plots it against what actually happened.

0