diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-08-21 03:49:17 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-08-21 03:49:17 +0000 |
commit | db436adf761bd5cb7990745ceba2959ac4bfca7c (patch) | |
tree | 8878ce970fd9b3ac480f3c5ef953fbc85827e685 /src/backend/optimizer/plan/createplan.c | |
parent | 5588c559e6e21fae6ba1f162616f4fb4f680fb31 (diff) | |
download | postgresql-db436adf761bd5cb7990745ceba2959ac4bfca7c.tar.gz postgresql-db436adf761bd5cb7990745ceba2959ac4bfca7c.zip |
Major revision of sort-node handling: push knowledge of query
sort order down into planner, instead of handling it only at the very top
level of the planner. This fixes many things. An explicit sort is now
avoided if there is a cheaper alternative (typically an indexscan) not
only for ORDER BY, but also for the internal sort of GROUP BY. It works
even when there is no other reason (such as a WHERE condition) to consider
the indexscan. It works for indexes on functions. It works for indexes
on functions, backwards. It's just so cool...
CAUTION: I have changed the representation of SortClause nodes, therefore
THIS UPDATE BREAKS STORED RULES. You will need to initdb.
Diffstat (limited to 'src/backend/optimizer/plan/createplan.c')
-rw-r--r-- | src/backend/optimizer/plan/createplan.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 40923fe27da..d1f756fc7c1 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.73 1999/08/18 04:15:16 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.74 1999/08/21 03:49:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1131,7 +1131,6 @@ make_agg(List *tlist, Plan *lefttree) node->plan.targetlist = tlist; node->plan.lefttree = lefttree; node->plan.righttree = (Plan *) NULL; - node->aggs = NIL; return node; } @@ -1141,15 +1140,15 @@ make_group(List *tlist, bool tuplePerGroup, int ngrp, AttrNumber *grpColIdx, - Sort *lefttree) + Plan *lefttree) { Group *node = makeNode(Group); - copy_costsize(&node->plan, (Plan *) lefttree); + copy_costsize(&node->plan, lefttree); node->plan.state = (EState *) NULL; node->plan.qual = NULL; node->plan.targetlist = tlist; - node->plan.lefttree = (Plan *) lefttree; + node->plan.lefttree = lefttree; node->plan.righttree = (Plan *) NULL; node->tuplePerGroup = tuplePerGroup; node->numCols = ngrp; |