[prev] 16 [next]

Top-down Trace of QOpt (cont)

subquery_planner()
  • performs algebraic transformations/simplifications, e.g.
    • simplifies conditions in where clauses
    • converts sub-queries in where to top-level join
    • moves having clauses with no aggregate into where
    • flattens sub-queries in join list
    • simplifies join tree (e.g. removes redundant terms), etc.
  • sets up canonical version of query for plan generation
  • invokes grouping_planner() to produce best path
Code in: backend/optimizer/plan/planner.c