[prev] 12 [next]

Query Optimisation Process

Query optimisation proceeds in two stages (after parsing)...

Rewriting:

  • uses PostgreSQL's rule system
  • query tree is expanded to include e.g. view definitions
Planning and optimisation:
  • using cost-based analysis of generated paths
  • via one of two different path generators
  • chooses least-cost path from all those considered
Then produces a Plan tree from the selected path.