From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Simplify query_planner's API by having it return the top-level R |
Date: | 2013-08-05 19:01:34 |
Message-ID: | E1V6Q2A-0006b6-Ns@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Simplify query_planner's API by having it return the top-level RelOptInfo.
Formerly, query_planner returned one or possibly two Paths for the topmost
join relation, so that grouping_planner didn't see the join RelOptInfo
(at least not directly; it didn't have any hesitation about examining
cheapest_path->parent, though). However, correct selection of the Paths
involved a significant amount of coupling between query_planner and
grouping_planner, a problem which has gotten worse over time. It seems
best to give up on this API choice and instead return the topmost
RelOptInfo explicitly. Then grouping_planner can pull out the Paths it
wants from the rel's path list. In this way we can remove all knowledge
of grouping behaviors from query_planner.
The only real benefit of the old way is that in the case of an empty
FROM clause, we never made any RelOptInfos at all, just a Path. Now
we have to gin up a dummy RelOptInfo to represent the empty FROM clause.
That's not a very big deal though.
While at it, simplify query_planner's API a bit more by having the caller
set up root->tuple_fraction and root->limit_tuples, rather than passing
those values as separate parameters. Since query_planner no longer does
anything with either value, requiring it to fill the PlannerInfo fields
seemed pretty arbitrary.
This patch just rearranges code; it doesn't (intentionally) change any
behaviors. Followup patches will do more interesting things.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/3ced8837db2cd602422bb36102cec73289691d40
Modified Files
--------------
src/backend/optimizer/README | 6 +-
src/backend/optimizer/plan/planagg.c | 43 +++---
src/backend/optimizer/plan/planmain.c | 227 +++--------------------------
src/backend/optimizer/plan/planner.c | 191 ++++++++++++++++++++----
src/backend/optimizer/prep/prepjointree.c | 19 +--
src/backend/optimizer/util/relnode.c | 30 ++++
src/include/optimizer/pathnode.h | 1 +
src/include/optimizer/planmain.h | 7 +-
8 files changed, 247 insertions(+), 277 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2013-08-05 23:59:59 | pgsql: pgtest: allow passing parameters, e.g. -s/--silent |
Previous Message | Andres Freund | 2013-08-05 16:14:39 | Re: [COMMITTERS] pgsql: Add support for REFRESH MATERIALIZED VIEW CONCURRENTLY. |