diff options
author | Jeff Davis <jdavis@postgresql.org> | 2015-02-21 17:24:48 -0800 |
---|---|---|
committer | Jeff Davis <jdavis@postgresql.org> | 2015-02-21 17:24:48 -0800 |
commit | b419865a814abbca12bdd6eef6a3d5ed67f432e1 (patch) | |
tree | e1cce5a0394a5d83f8f42e1b33e265bd12b69613 /src/pl/plperl/plperl.c | |
parent | e9fd5545de3bb4efe163af4a9c957badac86ccd7 (diff) |
In array_agg(), don't create a new context for every group.
Previously, each new array created a new memory context that started
out at 8kB. This is incredibly wasteful when there are lots of small
groups of just a few elements each.
Change initArrayResult() and friends to accept a "subcontext" argument
to indicate whether the caller wants the ArrayBuildState allocated in
a new subcontext or not. If not, it can no longer be released
separately from the rest of the memory context.
Fixes bug report by Frank van Vugt on 2013-10-19.
Tomas Vondra. Reviewed by Ali Akbar, Tom Lane, and me.
Diffstat (limited to 'src/pl/plperl/plperl.c')
-rw-r--r-- | src/pl/plperl/plperl.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 492c1ef4d24..e3dda5d63bc 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -1218,7 +1218,7 @@ plperl_array_to_datum(SV *src, Oid typid, int32 typmod) errmsg("cannot convert Perl array to non-array type %s", format_type_be(typid)))); - astate = initArrayResult(elemtypid, CurrentMemoryContext); + astate = initArrayResult(elemtypid, CurrentMemoryContext, true); _sv_to_datum_finfo(elemtypid, &finfo, &typioparam); |