Re: OOM on EXPLAIN with lots of nodes

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Alexey Bashtanov <bashtanov(at)imap(dot)cc>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: OOM on EXPLAIN with lots of nodes
Date: 2015-01-14 21:02:28
Message-ID: CA+TgmoZtgjYr7gHAMxQQq9J577yDLi1Q6gw0-JooFkJZR9cNWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 13, 2015 at 8:16 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I wrote:
>> Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> writes:
>>> But do we really need to backpatch any of this?
>
>> Alexey's example consumes only a couple hundred MB in 9.2, vs about 7GB
>> peak in 9.3 and up. That seems like a pretty nasty regression.
>
> I did a bit more measurement of the time and backend memory consumption
> for Alexey's example EXPLAIN:
>
> 9.2: 0.9 sec, circa 200 MB
> HEAD: 56 sec, circa 7300 MB
> with patch below: 3.7 sec, circa 300 MB
>
> So while this doesn't get us all the way back down to where we were before
> we started trying to guarantee unique table/column identifiers in EXPLAIN
> printouts, it's at least a lot closer.
>
> Not sure whether to just commit this to HEAD and call it a day, or to
> risk back-patching.

I think we need to back-patch something; that's a pretty nasty
regression, and I have some EDB-internal reports that might be from
the same cause. I'm not too concerned about forcibly breaking the API
here, but I can understand why somebody might want to do that. If we
do, I like the idea of renaming ExplainInitState() or maybe by
replacing it by a NewExplainState() function that is used instead.
But I'm not sure how necessary it is really.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2015-01-14 21:25:52 Re: Parallel Seq Scan
Previous Message Robert Haas 2015-01-14 20:54:20 Re: Safe memory allocation functions