[prev] 13 [next]

Top-down Trace of QOpt

Top-level of query execution: backend/tcop/postgres.c

exec_simple_query(const char *query_string)
{
   // lots of setting up ... including starting xact
   parsetree_list = pg_parse_query(query_string);
   foreach(parsetree_item, parsetree_list) {
      // Query optimisation
      querytree_list = pg_analyze_and_rewrite(parsetree,...);
      plantree_list = pg_plan_queries(querytree_list,...);
      // Query execution
      portal = CreatePortal(...plantree_list...);
      PortalRun(portal,...);
   }
   // lots of cleaning up ... including close xact
}

Assumes that we are dealing with multiple queries (i.e. SQL statements)