pgsql: Rethink representation of index clauses' mapping to index column - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Rethink representation of index clauses' mapping to index column
Date
Msg-id E1RebZ6-00037q-Nj@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Rethink representation of index clauses' mapping to index columns.

In commit e2c2c2e8b1df7dfdb01e7e6f6191a569ce3c3195 I made use of nested
list structures to show which clauses went with which index columns, but
on reflection that's a data structure that only an old-line Lisp hacker
could love.  Worse, it adds unnecessary complication to the many places
that don't much care which clauses go with which index columns.  Revert
to the previous arrangement of flat lists of clauses, and instead add a
parallel integer list of column numbers.  The places that care about the
pairing can chase both lists with forboth(), while the places that don't
care just examine one list the same as before.

The only real downside to this is that there are now two more lists that
need to be passed to amcostestimate functions in case they care about
column matching (which btcostestimate does, so not passing the info is not
an option).  Rather than deal with 11-argument amcostestimate functions,
pass just the IndexPath and expect the functions to extract fields from it.
That gets us down to 7 arguments which is better than 11, and it seems
more future-proof against likely additions to the information we keep
about an index path.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/472d3935a2793343e450ba7cda4adbc323a984c3

Modified Files
--------------
doc/src/sgml/indexam.sgml               |   51 +---
src/backend/access/nbtree/nbtutils.c    |    2 +-
src/backend/nodes/outfuncs.c            |    2 +
src/backend/optimizer/path/costsize.c   |   50 ++---
src/backend/optimizer/path/indxpath.c   |  399 ++++++++++++++-----------------
src/backend/optimizer/plan/createplan.c |  309 ++++++++++--------------
src/backend/optimizer/plan/planner.c    |    2 +-
src/backend/optimizer/util/pathnode.c   |   35 ++-
src/backend/utils/adt/selfuncs.c        |  309 +++++++++++-------------
src/include/catalog/catversion.h        |    2 +-
src/include/catalog/pg_proc.h           |   10 +-
src/include/nodes/relation.h            |   46 ++--
src/include/optimizer/cost.h            |    5 +-
src/include/optimizer/pathnode.h        |    4 +-
src/include/optimizer/paths.h           |    7 +-
src/include/pg_config_manual.h          |    2 +-
16 files changed, 546 insertions(+), 689 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Improve planner's handling of duplicated index column expression
Next
From: Alvaro Herrera
Date:
Subject: pgsql: Minor enhancements to MVCC chapter