From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Improve planner's ability to recognize cases where an IN's RHS i |
Date: | 2011-10-26 21:52:46 |
Message-ID: | E1RJBOw-00049s-6w@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Improve planner's ability to recognize cases where an IN's RHS is unique.
If the right-hand side of a semijoin is unique, then we can treat it like a
normal join (or another way to say that is: we don't need to explicitly
unique-ify the data before doing it as a normal join). We were recognizing
such cases when the RHS was a sub-query with appropriate DISTINCT or GROUP
BY decoration, but there's another way: if the RHS is a plain relation with
unique indexes, we can check if any of the indexes prove the output is
unique. Most of the infrastructure for that was there already in the join
removal code, though I had to rearrange it a bit. Per reflection about a
recent example in pgsql-performance.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/3e4b3465b6345b75659e8f897976d4c810408762
Modified Files
--------------
src/backend/optimizer/path/indxpath.c | 114 ++++++++++++++++++++++++++---
src/backend/optimizer/plan/analyzejoins.c | 39 +---------
src/backend/optimizer/util/pathnode.c | 27 ++++++-
src/include/optimizer/paths.h | 3 +-
4 files changed, 134 insertions(+), 49 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-10-26 22:04:55 | pgsql: Typo fixes. |
Previous Message | Bruce Momjian | 2011-10-26 21:26:26 | Re: pgsql: Fix pg_bsd_indent bug where newlines were not being trimmed from |