From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Lucas Fairchild-Madar <lucas.madar@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: json(b)_array_elements use causes very large memory usage when also referencing entire json document
Date: Fri, 06 Oct 2017 20:36:20 -0400
Message-ID: <2714.1507336580@sss.pgh.pa.us> (raw)
In-Reply-To: <20171007002116.2fqr6z26byhsjwoe@alap3.anarazel.de>
References: <CAJmoq7OJ=ntoLRE0R8h+_Dt8KoNifDhQQua_w2y_d1e7T6nL-w@mail.gmail.com>
<1546.1507314635@sss.pgh.pa.us>
<CAJmoq7OmXJ_G87D_He5j9kRSraANsuV7Oatxg3bhMsuawvOJ3Q@mail.gmail.com>
<2376.1507315734@sss.pgh.pa.us>
<CAJmoq7MKcfk2+X8A5OeQqedg9rypGoesOOg2pJQ3SzfNBE22TA@mail.gmail.com>
<4514.1507318623@sss.pgh.pa.us>
<20171007002116.2fqr6z26byhsjwoe@alap3.anarazel.de>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Andres Freund <andres@anarazel.de> writes:
> On 2017-10-06 15:37:03 -0400, Tom Lane wrote:
>> As of v10, it might be possible to fix this for the tlist case
>> as well, by doing something like using a separate short-lived
>> context for the non-SRF tlist items.
> Yea, that should be quite doable, slightly annoying to need more than
> one expr context, but that seems unavoidable.
BTW, another idea that occurred to me is to change things so we only
evaluate scalar tlist items once per SRF cycle, and just re-use their
old values for additional SRF output rows. However, to preserve current
semantics we'd have to distinguish volatile vs. non-volatile tlist items,
and be sure to do the former over again for each SRF output row. So
I'm not really excited about that, because of the amount of complexity
it would add. This is messy enough without having two code paths for
the scalar items ... and we'd still have the memory leak issue in the
volatile case.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, lucas.madar@gmail.com
Subject: Re: json(b)_array_elements use causes very large memory usage when also referencing entire json document
In-Reply-To: <2714.1507336580@sss.pgh.pa.us>
References: <CAJmoq7OJ=ntoLRE0R8h+_Dt8KoNifDhQQua_w2y_d1e7T6nL-w@mail.gmail.com> <1546.1507314635@sss.pgh.pa.us> <CAJmoq7OmXJ_G87D_He5j9kRSraANsuV7Oatxg3bhMsuawvOJ3Q@mail.gmail.com> <2376.1507315734@sss.pgh.pa.us> <CAJmoq7MKcfk2+X8A5OeQqedg9rypGoesOOg2pJQ3SzfNBE22TA@mail.gmail.com> <4514.1507318623@sss.pgh.pa.us> <20171007002116.2fqr6z26byhsjwoe@alap3.anarazel.de> <2714.1507336580@sss.pgh.pa.us>
* 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