[prev] 47 [next]

PostgreSQL Query Tuning

PostgreSQL provides the explain statement to
  • give a representation of the query execution plan
  • with information that may help to tune query performance
Usage:

EXPLAIN [ANALYZE] Query

Without ANALYZE, EXPLAIN shows plan with estimated costs.

With ANALYZE, EXPLAIN executes query and prints real costs.

Note that runtimes may show considerable variation due to buffering.