Re: Excessive memory usage in multi-statement queries w/ partitioning

From: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>
To: Andreas Seltenreich <andreas(dot)seltenreich(at)credativ(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Excessive memory usage in multi-statement queries w/ partitioning
Date: 2019-05-23 08:47:48
Message-ID: CAKJS1f_aY0Vka-TpAMoL366-npbZddRSZfXACk=jf+N0cRszhg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 23 May 2019 at 17:55, Andreas Seltenreich
<andreas(dot)seltenreich(at)credativ(dot)de> wrote:
> a customer reported excessive memory usage and out-of-memory ERRORs
> after introducing native partitioning in one of their databases. We
> could narrow it down to the overhead introduced by the partitioning when
> issuing multiple statements in a single query.

"multiple statements in a single query", did you mean to write session
or maybe transaction there?

Which version?

I tried your test case with REL_11_STABLE and I see nowhere near as
much memory used in MessageContext.

After repeating the query twice, I see:

MessageContext: 8388608 total in 11 blocks; 3776960 free (1 chunks);
4611648 used
Grand total: 8388608 bytes in 11 blocks; 3776960 free (1 chunks); 4611648 used
MessageContext: 8388608 total in 11 blocks; 3776960 free (1 chunks);
4611648 used
Grand total: 8388608 bytes in 11 blocks; 3776960 free (1 chunks); 4611648 used

which is quite a long way off the 252MB you're getting.

perhaps I'm not testing with the same version as you are.

--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Attachment Content-Type Size
dump_MessageContext_stats.diff application/octet-stream 458 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2019-05-23 08:57:18 Re: Why could GEQO produce plans with lower costs than the standard_join_search?
Previous Message Kyotaro HORIGUCHI 2019-05-23 07:10:35 Re: [HACKERS] WAL logging problem in 9.4.3?