EXPLAIN ANALYZE
Actual execution plan with timings. See what planner chose + why slow. Postgres: BUFFERS, ANALYZE, TIMING options.
Advertisement
Common issues
Sequential scan on large table. Nested loop with too many rows. Missing index. Type mismatch prevents index use.
Advertisement
Rewrite techniques
Push predicates down. Avoid SELECT *. Use EXISTS instead of IN when scoping. CTE vs subquery.