Command
ANALYZE
Modifier that makes EXPLAIN actually run the query and report measured execution times alongside the planner's estimates.
ANALYZE is most often seen as EXPLAIN ANALYZE. It tells PostgreSQL to execute the query and instrument every step, so the resulting plan includes both the estimated row counts and costs and the actual rows produced and time spent.
The combination is the most reliable way to see why a query is slow because the measured numbers do not depend on planner statistics. Comparing estimated vs actual row counts is one of the fastest ways to spot stale statistics or misestimation that is causing a bad plan.
Note that EXPLAIN ANALYZE actually runs the query — including side effects from INSERT, UPDATE, or DELETE — so wrap destructive statements in a transaction you can roll back.