summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2005-01-28 19:36:33 +0000
committerTom Lane2005-01-28 19:36:33 +0000
commita098f533d15efe5552c0b6cd661cc123231c8c54 (patch)
treeebe55a8f91b584c66805ad50600647a1a756d2c4 /src/include
parentaf5cd5ba92036f07f8414b15ec96da096ded8d7e (diff)
Improve planner's estimation of the space needed for HashAgg plans:
look at the actual aggregate transition datatypes and the actual overhead needed by nodeAgg.c, instead of using pessimistic round numbers. Per a discussion with Michael Tiemann.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/executor/nodeAgg.h4
-rw-r--r--src/include/optimizer/clauses.h13
2 files changed, 12 insertions, 5 deletions
diff --git a/src/include/executor/nodeAgg.h b/src/include/executor/nodeAgg.h
index 32449c22aab..cb9631ea268 100644
--- a/src/include/executor/nodeAgg.h
+++ b/src/include/executor/nodeAgg.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/executor/nodeAgg.h,v 1.23 2004/12/31 22:03:29 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/executor/nodeAgg.h,v 1.23.4.1 2005/01/28 19:36:17 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,6 +23,8 @@ extern TupleTableSlot *ExecAgg(AggState *node);
extern void ExecEndAgg(AggState *node);
extern void ExecReScanAgg(AggState *node, ExprContext *exprCtxt);
+extern Size hash_agg_entry_size(int numAggs);
+
extern Datum aggregate_dummy(PG_FUNCTION_ARGS);
#endif /* NODEAGG_H */
diff --git a/src/include/optimizer/clauses.h b/src/include/optimizer/clauses.h
index 368c69f68b2..a3ea4477463 100644
--- a/src/include/optimizer/clauses.h
+++ b/src/include/optimizer/clauses.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/optimizer/clauses.h,v 1.77 2004/12/31 22:03:36 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/optimizer/clauses.h,v 1.77.4.1 2005/01/28 19:36:33 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,11 +17,17 @@
#include "nodes/relation.h"
-
#define is_opclause(clause) ((clause) != NULL && IsA(clause, OpExpr))
#define is_funcclause(clause) ((clause) != NULL && IsA(clause, FuncExpr))
#define is_subplan(clause) ((clause) != NULL && IsA(clause, SubPlan))
+typedef struct
+{
+ int numAggs; /* total number of aggregate calls */
+ int numDistinctAggs; /* number that use DISTINCT */
+ Size transitionSpace; /* for pass-by-ref transition data */
+} AggClauseCounts;
+
extern Expr *make_opclause(Oid opno, Oid opresulttype, bool opretset,
Expr *leftop, Expr *rightop);
@@ -42,8 +48,7 @@ extern Expr *make_ands_explicit(List *andclauses);
extern List *make_ands_implicit(Expr *clause);
extern bool contain_agg_clause(Node *clause);
-extern bool contain_distinct_agg_clause(Node *clause);
-extern int count_agg_clause(Node *clause);
+extern void count_agg_clauses(Node *clause, AggClauseCounts *counts);
extern bool expression_returns_set(Node *clause);