diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2014-07-15 21:12:43 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2014-07-15 21:12:43 -0400 |
commit | f15821eefd70941d4ec5bd77d75c1da5534ba6b2 (patch) | |
tree | e5700bb11d48a7c28871d144f0db548e982591d4 /src/backend/regex/regcomp.c | |
parent | 5571caf42d62ea30c452b0ae5f1748289ae613b4 (diff) | |
download | postgresql-f15821eefd70941d4ec5bd77d75c1da5534ba6b2.tar.gz postgresql-f15821eefd70941d4ec5bd77d75c1da5534ba6b2.zip |
Allow join removal in some cases involving a left join to a subquery.
We can remove a left join to a relation if the relation's output is
provably distinct for the columns involved in the join clause (considering
only equijoin clauses) and the relation supplies no variables needed above
the join. Previously, the join removal logic could only prove distinctness
by reference to unique indexes of a table. This patch extends the logic
to consider subquery relations, wherein distinctness might be proven by
reference to GROUP BY, DISTINCT, etc.
We actually already had some code to check that a subquery's output was
provably distinct, but it was hidden inside pathnode.c; which was a pretty
bad place for it really, since that file is mostly boilerplate Path
construction and comparison. Move that code to analyzejoins.c, which is
arguably a more appropriate location, and is certainly the site of the
new usage for it.
David Rowley, reviewed by Simon Riggs
Diffstat (limited to 'src/backend/regex/regcomp.c')
0 files changed, 0 insertions, 0 deletions