From: Andres Freund <andres@anarazel.de>
To: pgsql-bugs@lists.postgresql.org,Tom Lane <tgl@sss.pgh.pa.us>
To: amdmi3@amdmi3.ru
Subject: Re: BUG #15592: Memory overuse with subquery containing unnest() and set operations (11.x regression)
Date: Mon, 14 Jan 2019 08:39:21 -0800
Message-ID: <3935CFAF-8FD4-459E-B13F-67DFEE852028@anarazel.de> (raw)
In-Reply-To: <26375.1547483080@sss.pgh.pa.us>
References: <15592-cc5729f9ba02e31c@postgresql.org>
<26375.1547483080@sss.pgh.pa.us>
On January 14, 2019 8:24:40 AM PST, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
>> After upgrading from PostgreSQL 10.x to 11.x this query began to eat
>> inadequate amounts of memory (several gigabytes per hundred thousands
>rows).
>> I've narrowed it down to this simple case which demonstrates the
>problem:
>
>> CREATE TABLE test AS
>> SELECT generate_series(1,500000) AS id, '{a,b}'::text[] AS first,
>> '{a}'::text[] AS second;
>
>> SELECT DISTINCT EXISTS(SELECT unnest(first) INTERSECT SELECT
>unnest(second))
>> FROM test;
>
>Ugh. Something is creating ExprContexts and not freeing them --- a
>memory
>context dump taken at ExecutorEnd shows
>
>ExecutorState: 100663296 total in 22 blocks; 4625424 free (19 chunks);
>96037872 used
> ExprContext: 8192 total in 1 blocks; 7936 free (0 chunks); 256 used
> ExprContext: 8192 total in 1 blocks; 7936 free (0 chunks); 256 used
> ExprContext: 8192 total in 1 blocks; 7936 free (0 chunks); 256 used
> ...
>499916 more child contexts containing 4095311872 total in 499916
>blocks; 3967322616 free (1 chunks); 127989256 used
>
>Not sure where the problem is, yet, but for sure this is a bug.
>Thanks for the report!
Think I know where the problem is - let me have a coffee and check? I think I might have a good lying around...
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
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: andres@anarazel.de, tgl@sss.pgh.pa.us, amdmi3@amdmi3.ru
Subject: Re: BUG #15592: Memory overuse with subquery containing unnest() and set operations (11.x regression)
In-Reply-To: <3935CFAF-8FD4-459E-B13F-67DFEE852028@anarazel.de>
References: <15592-cc5729f9ba02e31c@postgresql.org> <26375.1547483080@sss.pgh.pa.us> <3935CFAF-8FD4-459E-B13F-67DFEE852028@anarazel.de>
* 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