Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit22d9ddb

Browse files
committed
Fix planner to make a reasonable assumption about the amount of memory space
used by array_agg(), string_agg(), and similar aggregate functions that use"internal" as their transition datatype. The previous coding thought thistook *no* extra space, since "internal" is pass-by-value; but actually theseaggregates typically consume a great deal of space. Per bug #5608 fromItagaki Takahiro, and fix suggestion from Hitoshi Harada.Back-patch to 8.4, where array_agg was introduced.
1 parent41b810f commit22d9ddb

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎src/backend/optimizer/util/clauses.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.287 2010/03/19 22:54:41 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.288 2010/08/14 15:47:13 tgl Exp $
1212
*
1313
* HISTORY
1414
* AUTHORDATEMAJOR EVENT
@@ -549,6 +549,18 @@ count_agg_clauses_walker(Node *node, AggClauseCounts *counts)
549549

550550
counts->transitionSpace+=avgwidth+2*sizeof(void*);
551551
}
552+
elseif (aggtranstype==INTERNALOID)
553+
{
554+
/*
555+
* INTERNAL transition type is a special case: although INTERNAL
556+
* is pass-by-value, it's almost certainly being used as a pointer
557+
* to some large data structure. We assume usage of
558+
* ALLOCSET_DEFAULT_INITSIZE, which is a good guess if the data is
559+
* being kept in a private memory context, as is done by
560+
* array_agg() for instance.
561+
*/
562+
counts->transitionSpace+=ALLOCSET_DEFAULT_INITSIZE;
563+
}
552564

553565
/*
554566
* Complain if the aggregate's arguments contain any aggregates;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp