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/backend/commands/explain.c | |
parent | ef1c807c25b47960aa86cd185fb74371e88d0cbf (diff) | |
download | postgresql-e006a24ad152b3faec748afe8c1ff0829699b2e6.tar.gz postgresql-e006a24ad152b3faec748afe8c1ff0829699b2e6.zip |
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/backend/commands/explain.c')
-rw-r--r-- | src/backend/commands/explain.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 1fd6f0cb331..d0033f43662 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -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"; |