diff --git a/src/backend/optimizer/README b/src/backend/optimizer/README index f9a2cb982f..98639181d4 100644 --- a/src/backend/optimizer/README +++ b/src/backend/optimizer/README @@ -9,6 +9,7 @@ planner() preprocess target list preprocess qualifications(WHERE) --query_planner() + cnfify qualification, so qual are expressions (were AND's) and OR clauses pull out constants from target list get a target list that only contains column names, no expressions if none, then return diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c index 3f7b5281cf..28515fba93 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.18 1998/08/04 00:42:07 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.19 1998/08/07 05:02:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -45,6 +45,7 @@ int32 _use_geqo_rels_ = GEQO_RELS; static void find_rel_paths(Query *root, List *rels); static List *find_join_paths(Query *root, List *outer_rels, int levels_needed); +static void debug_print_rel(Query *root, RelOptInfo *rel); /* * find-paths-- @@ -173,7 +174,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed) { List *x; List *new_rels = NIL; - RelOptInfo *rel; + RelOptInfo *rel; /******************************************* * genetic query optimizer entry point * @@ -236,7 +237,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed) /* #define OPTIMIZER_DEBUG */ #ifdef OPTIMIZER_DEBUG - printf("levels left: %d\n", levels_left); + printf("levels left: %d\n", levels_needed); debug_print_rel(root, rel); #endif } diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c index cf05b30be6..607f980ac5 100644 --- a/src/backend/optimizer/plan/initsplan.c +++ b/src/backend/optimizer/plan/initsplan.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.14 1998/08/04 16:44:14 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.15 1998/08/07 05:02:17 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -36,8 +36,7 @@ extern int Quiet; static void add_clause_to_rels(Query *root, List *clause); -static void -add_join_clause_info_to_rels(Query *root, CInfo *clauseinfo, +static void add_join_clause_info_to_rels(Query *root, CInfo *clauseinfo, List *join_relids); static void add_vars_to_rels(Query *root, List *vars, List *join_relids); @@ -183,8 +182,6 @@ add_clause_to_rels(Query *root, List *clause) clauseinfo->mergejoinorder = (MergeOrder *) NULL; clauseinfo->hashjoinoperator = (Oid) 0; - - if (length(relids) == 1) { RelOptInfo *rel = get_base_rel(root, lfirsti(relids)); diff --git a/src/backend/optimizer/plan/planmain.c b/src/backend/optimizer/plan/planmain.c index d1825f80ea..1d4340e08d 100644 --- a/src/backend/optimizer/plan/planmain.c +++ b/src/backend/optimizer/plan/planmain.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.23 1998/07/18 04:22:37 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.24 1998/08/07 05:02:19 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -18,6 +18,7 @@ #include "nodes/pg_list.h" #include "nodes/plannodes.h" #include "nodes/parsenodes.h" +#include "nodes/print.h" #include "nodes/relation.h" #include "nodes/makefuncs.h" @@ -85,7 +86,11 @@ query_planner(Query *root, qual = (List *) SS_process_sublinks((Node *) qual); qual = cnfify((Expr *) qual, true); - +#ifdef OPTIMIZER_DEBUG + printf("After cnfify()\n"); + pprint(qual); +#endif + /* * A command without a target list or qualification is an error, * except for "delete foo". @@ -250,8 +255,8 @@ subplanner(Query *root, List *flat_tlist, List *qual) { - RelOptInfo *final_relation; - List *final_relation_list; + RelOptInfo *final_relation; + List *final_relation_list; /* * Initialize the targetlist and qualification, adding entries to diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c index e37da74b53..61a7f2d473 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.17 1998/06/15 19:28:47 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.18 1998/08/07 05:02:22 momjian Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -350,8 +350,6 @@ pull_constant_clauses(List *quals, List **constantQual) * * Returns the list of relids and vars. * - * XXX take the nreverse's out later - * */ void clause_relids_vars(Node *clause, List **relids, List **vars) diff --git a/src/tools/backend/flow.fig b/src/tools/backend/flow.fig index 35124b1f05..0984b51258 100644 --- a/src/tools/backend/flow.fig +++ b/src/tools/backend/flow.fig @@ -7,10 +7,6 @@ Inches 0 0 2.00 150.00 180.00 0 0 2.00 150.00 180.00 7950 10200 7950 10800 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1 - 8400 375 -2 1 0 1 -1 7 0 0 -1 0.000 0 0 -1 0 0 1 - 8400 375 2 4 0 1 -1 29 0 0 20 0.000 0 0 7 0 0 5 2775 11400 375 11400 375 10800 2775 10800 2775 11400 2 1 0 2 29 7 0 0 -1 0.000 0 0 -1 1 1 2 @@ -73,10 +69,6 @@ Inches 2 1 0 2 20 7 0 0 -1 0.000 0 0 -1 1 0 2 0 0 2.00 150.00 180.00 2550 2175 6450 2775 -2 1 1 2 -1 7 0 0 -1 4.000 0 0 -1 1 1 2 - 0 0 2.00 150.00 180.00 - 0 0 2.00 150.00 180.00 - 4815 1908 5250 1350 2 4 0 1 -1 29 0 0 20 0.000 0 0 7 0 0 5 7650 12600 5250 12600 5250 12000 7650 12000 7650 12600 2 1 0 2 29 7 0 0 -1 0.000 0 0 -1 1 1 2 @@ -88,16 +80,20 @@ Inches 3750 5775 5250 5775 2 4 0 1 -1 8 0 0 20 0.000 0 0 7 0 0 5 3750 6075 1350 6075 1350 5475 3750 5475 3750 6075 -2 1 1 2 -1 7 0 0 -1 3.000 0 0 -1 1 1 2 - 0 0 2.00 150.00 180.00 - 0 0 2.00 150.00 180.00 - 4660 1524 5295 1293 2 1 0 2 8 7 0 0 -1 0.000 0 0 -1 1 0 2 0 0 2.00 150.00 180.00 2550 7275 2550 7875 2 1 0 2 31 7 0 0 -1 0.000 0 0 -1 1 0 2 0 0 2.00 150.00 180.00 2550 3300 2550 4275 +2 1 2 2 -1 7 0 0 -1 4.000 0 1 -1 1 1 2 + 0 0 2.00 80.00 150.00 + 0 0 2.00 80.00 150.00 + 4800 1875 5235 1317 +2 1 2 2 -1 7 0 0 -1 3.000 0 1 -1 1 1 2 + 0 0 2.00 80.00 150.00 + 0 0 2.00 80.00 150.00 + 4584 1524 5219 1293 3 0 0 2 8 7 0 0 -1 0.000 0 1 0 8 0 0 2.00 150.00 150.00 1350 9375 1050 9375 825 9000 825 4425 1050 4050 1500 3975 diff --git a/src/tools/backend/flow.jpg b/src/tools/backend/flow.jpg index f744394d87..0a17ed434b 100644 Binary files a/src/tools/backend/flow.jpg and b/src/tools/backend/flow.jpg differ diff --git a/src/tools/backend/index.html b/src/tools/backend/index.html index f43d6385cb..5edafb8bc5 100644 --- a/src/tools/backend/index.html +++ b/src/tools/backend/index.html @@ -16,23 +16,23 @@ by Bruce Momjian flowchart - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
Click on an item to see more detail or look at the full