1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +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:
Tom Lane
2008-08-14 18:48:00 +00:00
parent ef1c807c25
commit e006a24ad1
40 changed files with 2129 additions and 1204 deletions

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.176 2008/08/07 03:04:03 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.177 2008/08/14 18:47:58 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -450,8 +450,11 @@ explain_outNode(StringInfo str,
case JOIN_RIGHT:
pname = "Nested Loop Right Join";
break;
case JOIN_IN:
pname = "Nested Loop IN Join";
case JOIN_SEMI:
pname = "Nested Loop Semi Join";
break;
case JOIN_ANTI:
pname = "Nested Loop Anti Join";
break;
default:
pname = "Nested Loop ??? Join";
@ -473,8 +476,11 @@ explain_outNode(StringInfo str,
case JOIN_RIGHT:
pname = "Merge Right Join";
break;
case JOIN_IN:
pname = "Merge IN Join";
case JOIN_SEMI:
pname = "Merge Semi Join";
break;
case JOIN_ANTI:
pname = "Merge Anti Join";
break;
default:
pname = "Merge ??? Join";
@ -496,8 +502,11 @@ explain_outNode(StringInfo str,
case JOIN_RIGHT:
pname = "Hash Right Join";
break;
case JOIN_IN:
pname = "Hash IN Join";
case JOIN_SEMI:
pname = "Hash Semi Join";
break;
case JOIN_ANTI:
pname = "Hash Anti Join";
break;
default:
pname = "Hash ??? Join";