[prev] 58 [next]

PostgreSQL Query Evaluation (cont)

PlannedStmt *planner(Query *parse, ...)
  • defined in optimizer/plan/planner.c
  • subquery_planner() performs standard transformations
    • e.g. push selection and projection down the tree
  • then invokes a cost-based optimiser:
    • choose possible plan (execution order for operations)
    • choose physical operations for this plan
    • estimate cost of this plan (using DB statistics)
    • do this for sufficient cases and pick cheapest