pgsql: Use parameterized paths to generate inner indexscans more flexib - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Use parameterized paths to generate inner indexscans more flexib
Date
Msg-id E1RqwRk-0002s9-78@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Undo 8.4-era lobotomization of subquery pullup rules.
Next
From: Tom Lane
Date:
Subject: pgsql: Fix error detection in contrib/pgcrypto's encrypt_iv() and decry