From: Jeff Davis <jdavis@postgresql.org>
To: pgsql-committers@postgresql.org
Subject: pgsql: In array_agg(), don't create a new context for every group.
Date: Sun, 22 Feb 2015 01:30:34 +0000
Message-ID: <E1YPLNS-0003kw-1T@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
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.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/b419865a814abbca12bdd6eef6a3d5ed67f432e1
Modified Files
--------------
src/backend/executor/nodeSubplan.c | 4 +-
src/backend/utils/adt/array_userfuncs.c | 14 +++-
src/backend/utils/adt/arrayfuncs.c | 106 +++++++++++++++++++++----------
src/backend/utils/adt/xml.c | 2 +-
src/include/utils/array.h | 8 ++-
src/pl/plperl/plperl.c | 2 +-
6 files changed, 92 insertions(+), 44 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: jdavis@postgresql.org
Subject: Re: pgsql: In array_agg(), don't create a new context for every group.
In-Reply-To: <E1YPLNS-0003kw-1T@gemulon.postgresql.org>
References: <E1YPLNS-0003kw-1T@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox