]> granicus.if.org Git - postgresql/commit
Implement "join removal" for cases where the inner side of a left join
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 17 Sep 2009 20:49:29 +0000 (20:49 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 17 Sep 2009 20:49:29 +0000 (20:49 +0000)
commit488d70ab46311386801c10691196ec8d755f2283
tree043fc65616c8690113e2b5c18222bcd230197c9b
parente3f027115a5a5109527238886bde7f6d5b4a5b96
Implement "join removal" for cases where the inner side of a left join
is unique and is not referenced above the join.  In this case the inner
side doesn't affect the query result and can be thrown away entirely.
Although perhaps nobody would ever write such a thing by hand, it's
a reasonably common case in machine-generated SQL.

The current implementation only recognizes the case where the inner side
is a simple relation with a unique index matching the query conditions.
This is enough for the use-cases that have been shown so far, but we
might want to try to handle other cases later.

Robert Haas, somewhat rewritten by Tom
src/backend/nodes/outfuncs.c
src/backend/optimizer/README
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/joinpath.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/util/pathnode.c
src/include/nodes/nodes.h
src/include/nodes/relation.h
src/include/optimizer/pathnode.h
src/include/optimizer/paths.h