pgsql: Use parameterized paths to generate inner indexscans more flexib

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Use parameterized paths to generate inner indexscans more flexib
Date: 2012-01-28 00:47:12
Message-ID: E1RqwRk-0002s9-78@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use parameterized paths to generate inner indexscans more flexibly.

This patch fixes the planner so that it can generate nestloop-with-
inner-indexscan plans even with one or more levels of joining between
the indexscan and the nestloop join that is supplying the parameter.
The executor was fixed to handle such cases some time ago, but the
planner was not ready. This should improve our plans in many situations
where join ordering restrictions formerly forced complete table scans.

There is probably a fair amount of tuning work yet to be done, because
of various heuristics that have been added to limit the number of
parameterized paths considered. However, we are not going to find out
what needs to be adjusted until the code gets some real-world use, so
it's time to get it in there where it can be tested easily.

Note API change for index AM amcostestimate functions. I'm not aware of
any non-core index AMs, but if there are any, they will need minor
adjustments.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/e2fa76d80ba571d4de8992de6386536867250474

Modified Files
--------------
doc/src/sgml/indexam.sgml | 25 +-
src/backend/nodes/bitmapset.c | 77 ++
src/backend/nodes/outfuncs.c | 25 +-
src/backend/optimizer/README | 129 ++-
src/backend/optimizer/path/allpaths.c | 562 ++++++---
src/backend/optimizer/path/costsize.c | 1052 ++++++++++-----
src/backend/optimizer/path/equivclass.c | 149 ++-
src/backend/optimizer/path/indxpath.c | 2010 +++++++++++++++--------------
src/backend/optimizer/path/joinpath.c | 745 ++++++++----
src/backend/optimizer/path/joinrels.c | 7 +-
src/backend/optimizer/path/orindxpath.c | 10 +-
src/backend/optimizer/path/pathkeys.c | 17 +-
src/backend/optimizer/plan/createplan.c | 35 +-
src/backend/optimizer/plan/planmain.c | 1 +
src/backend/optimizer/plan/planner.c | 3 +-
src/backend/optimizer/util/pathnode.c | 897 ++++++++++----
src/backend/optimizer/util/relnode.c | 6 +-
src/backend/optimizer/util/restrictinfo.c | 85 +--
src/backend/utils/adt/selfuncs.c | 37 +-
src/include/nodes/bitmapset.h | 10 +
src/include/nodes/nodes.h | 1 -
src/include/nodes/relation.h | 192 ++--
src/include/optimizer/cost.h | 48 +-
src/include/optimizer/pathnode.h | 21 +-
src/include/optimizer/paths.h | 21 +-
src/include/optimizer/restrictinfo.h | 5 +-
26 files changed, 3881 insertions(+), 2289 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2012-01-28 04:10:28 pgsql: Fix error detection in contrib/pgcrypto's encrypt_iv() and decry
Previous Message Peter Eisentraut 2012-01-27 20:02:45 pgsql: Show default privileges in information schema