mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
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.
This commit is contained in:
@@ -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 */
|
||||
|
Reference in New Issue
Block a user