What does Recheck Cond mean in a PostgreSQL execution plan?
In PostgreSQL 16, a query uses an index, but the execution plan shows two nodes: Bitmap Heap Scan on orders at the top, with Recheck Cond: (customer_id = 42), and Bitmap Index Scan on orders_customer_idx below it, with Index Cond: (customer_id = 42).
Explain how PostgreSQL executes this plan. Why does the same condition appear in both nodes? What does the executor actually do with Recheck Cond at runtime? Which metrics in the actual execution plan show how much work the rechecks required?
ExplainEXPLAIN and optimizationSeniorBackendData Engineer