mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +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:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.89 2008/01/01 19:45:50 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/optimizer/util/relnode.c,v 1.90 2008/08/14 18:47:59 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -273,7 +273,7 @@ find_join_rel(PlannerInfo *root, Relids relids)
|
||||
* 'joinrelids' is the Relids set that uniquely identifies the join
|
||||
* 'outer_rel' and 'inner_rel' are relation nodes for the relations to be
|
||||
* joined
|
||||
* 'jointype': type of join (inner/outer)
|
||||
* 'sjinfo': join context info
|
||||
* 'restrictlist_ptr': result variable. If not NULL, *restrictlist_ptr
|
||||
* receives the list of RestrictInfo nodes that apply to this
|
||||
* particular pair of joinable relations.
|
||||
@ -286,7 +286,7 @@ build_join_rel(PlannerInfo *root,
|
||||
Relids joinrelids,
|
||||
RelOptInfo *outer_rel,
|
||||
RelOptInfo *inner_rel,
|
||||
JoinType jointype,
|
||||
SpecialJoinInfo *sjinfo,
|
||||
List **restrictlist_ptr)
|
||||
{
|
||||
RelOptInfo *joinrel;
|
||||
@ -375,7 +375,7 @@ build_join_rel(PlannerInfo *root,
|
||||
* Set estimates of the joinrel's size.
|
||||
*/
|
||||
set_joinrel_size_estimates(root, joinrel, outer_rel, inner_rel,
|
||||
jointype, restrictlist);
|
||||
sjinfo, restrictlist);
|
||||
|
||||
/*
|
||||
* Add the joinrel to the query's joinrel list, and store it into the
|
||||
|
Reference in New Issue
Block a user