diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-08-14 18:48:00 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-08-14 18:48:00 +0000 |
| commit | e006a24ad152b3faec748afe8c1ff0829699b2e6 (patch) | |
| tree | d00e01d25270b4b04aac3c723b9e440a56d8a085 /src/include/optimizer/cost.h | |
| parent | ef1c807c25b47960aa86cd185fb74371e88d0cbf (diff) | |
| download | postgresql-e006a24ad152b3faec748afe8c1ff0829699b2e6.tar.gz | |
Implement SEMI and ANTI joins in the planner and executor. (Semijoins replace
the old JOIN_IN code, but antijoins are new functionality.) Teach the planner
to convert appropriate EXISTS and NOT EXISTS subqueries into semi and anti
joins respectively. Also, LEFT JOINs with suitable upper-level IS NULL
filters are recognized as being anti joins. Unify the InClauseInfo and
OuterJoinInfo infrastructure into "SpecialJoinInfo". With that change,
it becomes possible to associate a SpecialJoinInfo with every join attempt,
which permits some cleanup of join selectivity estimation. That needs to be
taken much further than this patch does, but the next step is to change the
API for oprjoin selectivity functions, which seems like material for a
separate patch. So for the moment the output size estimates for semi and
especially anti joins are quite bogus.
Diffstat (limited to 'src/include/optimizer/cost.h')
| -rw-r--r-- | src/include/optimizer/cost.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h index 6780846cb0..17caeb4ee4 100644 --- a/src/include/optimizer/cost.h +++ b/src/include/optimizer/cost.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/cost.h,v 1.90 2008/01/01 19:45:58 momjian Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/cost.h,v 1.91 2008/08/14 18:48:00 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -87,9 +87,12 @@ extern void cost_group(Path *path, PlannerInfo *root, int numGroupCols, double numGroups, Cost input_startup_cost, Cost input_total_cost, double input_tuples); -extern void cost_nestloop(NestPath *path, PlannerInfo *root); -extern void cost_mergejoin(MergePath *path, PlannerInfo *root); -extern void cost_hashjoin(HashPath *path, PlannerInfo *root); +extern void cost_nestloop(NestPath *path, PlannerInfo *root, + SpecialJoinInfo *sjinfo); +extern void cost_mergejoin(MergePath *path, PlannerInfo *root, + SpecialJoinInfo *sjinfo); +extern void cost_hashjoin(HashPath *path, PlannerInfo *root, + SpecialJoinInfo *sjinfo); extern void cost_qual_eval(QualCost *cost, List *quals, PlannerInfo *root); extern void cost_qual_eval_node(QualCost *cost, Node *qual, PlannerInfo *root); extern Cost get_initplan_cost(PlannerInfo *root, SubPlan *subplan); @@ -97,7 +100,7 @@ extern void set_baserel_size_estimates(PlannerInfo *root, RelOptInfo *rel); extern void set_joinrel_size_estimates(PlannerInfo *root, RelOptInfo *rel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, - JoinType jointype, + SpecialJoinInfo *sjinfo, List *restrictlist); extern void set_function_size_estimates(PlannerInfo *root, RelOptInfo *rel); extern void set_values_size_estimates(PlannerInfo *root, RelOptInfo *rel); @@ -109,10 +112,12 @@ extern void set_values_size_estimates(PlannerInfo *root, RelOptInfo *rel); extern Selectivity clauselist_selectivity(PlannerInfo *root, List *clauses, int varRelid, - JoinType jointype); + JoinType jointype, + SpecialJoinInfo *sjinfo); extern Selectivity clause_selectivity(PlannerInfo *root, Node *clause, int varRelid, - JoinType jointype); + JoinType jointype, + SpecialJoinInfo *sjinfo); #endif /* COST_H */ |
