From f6dba10e623fa575c8446f854aa63c97d4fedea3 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 6 Nov 2002 00:00:45 +0000 Subject: First phase of implementing hash-based grouping/aggregation. An AGG plan node now does its own grouping of the input rows, and has no need for a preceding GROUP node in the plan pipeline. This allows elimination of the misnamed tuplePerGroup option for GROUP, and actually saves more code in nodeGroup.c than it costs in nodeAgg.c, as well as being presumably faster. Restructure the API of query_planner so that we do not commit to using a sorted or unsorted plan in query_planner; instead grouping_planner makes the decision. (Right now it isn't any smarter than query_planner was, but that will change as soon as it has the option to select a hash- based aggregation step.) Despite all the hackery, no initdb needed since only in-memory node types changed. --- src/backend/nodes/outfuncs.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'src/backend/nodes/outfuncs.c') diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index e1a34118a62..2d6db222b29 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.176 2002/10/14 22:14:34 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.177 2002/11/06 00:00:44 tgl Exp $ * * NOTES * Every (plan) node in POSTGRES has an associated "out" routine which @@ -597,6 +597,8 @@ _outAgg(StringInfo str, Agg *node) { appendStringInfo(str, " AGG "); _outPlanInfo(str, (Plan *) node); + appendStringInfo(str, " :aggstrategy %d :numCols %d ", + (int) node->aggstrategy, node->numCols); } static void @@ -604,11 +606,7 @@ _outGroup(StringInfo str, Group *node) { appendStringInfo(str, " GRP "); _outPlanInfo(str, (Plan *) node); - - /* the actual Group fields */ - appendStringInfo(str, " :numCols %d :tuplePerGroup %s ", - node->numCols, - booltostr(node->tuplePerGroup)); + appendStringInfo(str, " :numCols %d ", node->numCols); } static void @@ -1114,6 +1112,26 @@ _outAppendPath(StringInfo str, AppendPath *node) _outNode(str, node->subpaths); } +/* + * ResultPath is a subclass of Path. + */ +static void +_outResultPath(StringInfo str, ResultPath *node) +{ + appendStringInfo(str, + " RESULTPATH :pathtype %d :startup_cost %.2f :total_cost %.2f :pathkeys ", + node->path.pathtype, + node->path.startup_cost, + node->path.total_cost); + _outNode(str, node->path.pathkeys); + + appendStringInfo(str, " :subpath "); + _outNode(str, node->subpath); + + appendStringInfo(str, " :constantqual "); + _outNode(str, node->constantqual); +} + /* * NestPath is a subclass of Path */ @@ -1717,6 +1735,9 @@ _outNode(StringInfo str, void *obj) case T_AppendPath: _outAppendPath(str, obj); break; + case T_ResultPath: + _outResultPath(str, obj); + break; case T_NestPath: _outNestPath(str, obj); break; -- cgit v1.2.3