pgsql: Improve handling of group-column indexes in GroupingSetsPath. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Improve handling of group-column indexes in GroupingSetsPath.
Date
Msg-id E1adUrE-0003pF-SG@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Improve handling of group-column indexes in GroupingSetsPath.

Instead of having planner.c compute a groupColIdx array and store it in
GroupingSetsPaths, make create_groupingsets_plan() find the grouping
columns by searching in the child plan node's tlist.  Although that's
probably a bit slower for create_groupingsets_plan(), it's more like
the way every other plan node type does this, and it provides positive
confirmation that we know which child output columns we're supposed to be
grouping on.  (Indeed, looking at this now, I'm not at all sure that it
wasn't broken before, because create_groupingsets_plan() isn't demanding
an exact tlist match from its child node.)  Also, this allows substantial
simplification in planner.c, because it no longer needs to compute the
groupColIdx array at all; no other cases were using it.

I'd intended to put off this refactoring until later (like 9.7), but
in view of the likely bug fix and the need to rationalize planner.c's
tlist handling so we can do something sane with Konstantin Knizhnik's
function-evaluation-postponement patch, I think it can't wait.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/9e8b99420fe5f80495ada8dc50aeb7b954b33093

Modified Files
--------------
src/backend/nodes/outfuncs.c            |   1 -
src/backend/optimizer/plan/createplan.c |  12 +--
src/backend/optimizer/plan/planner.c    | 130 +++++++-------------------------
src/backend/optimizer/util/pathnode.c   |   5 +-
src/backend/optimizer/util/tlist.c      |  20 +++++
src/include/nodes/relation.h            |   1 -
src/include/optimizer/pathnode.h        |   1 -
src/include/optimizer/tlist.h           |   2 +
8 files changed, 57 insertions(+), 115 deletions(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: Handle invalid libpq sockets in more places
Next
From: Andres Freund
Date:
Subject: pgsql: Add valgrind suppressions for bootstrap related code.