PostgreSQL Index Types and Strategies/Explain with runtime stats

Inspect actual execution behavior.

Section: Plan inspection

Explain with runtime stats

sql
sql
EXPLAIN (ANALYZE, BUFFERS)
SELECT *
FROM orders
WHERE shipped_at IS NULL
ORDER BY created_at DESC
LIMIT 100;
Explanation

This is one of the most useful PostgreSQL performance tools for validating index choices.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Plan inspection
B-tree index
Default choice for equality, ranges, and ordering.
OpenIn sheetsql1 tag match
GIN index on JSONB
Speed containment queries on JSONB data.
OpenIn sheetsql1 tag match
BRIN index for large append-heavy tables
Use BRIN when physical order correlates with query ranges.
OpenIn sheetsql1 tag match
Expression index
Index the result of an expression used in predicates.
OpenIn sheetsql1 tag match
Partial index
Index only the rows a hot query actually needs.
OpenIn sheetsql1 tag match
Create index concurrently
Reduce blocking on busy tables.
OpenIn sheetsql1 tag match