Re: BUG #14843: CREATE TABLE churns through all memory, crashes db

Michael Paquier <michael.paquier@gmail.com>

From: Michael Paquier <michael.paquier@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: ropeladder@gmail.com, PostgreSQL mailing lists <pgsql-bugs@postgresql.org>, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2017-10-06T03:57:59Z
Lists: pgsql-bugs
On Fri, Oct 6, 2017 at 10:00 AM, Michael Paquier
<michael.paquier@gmail.com> wrote:
> This is suspicious:
>       ExecutorState: 62906368 total in 17 blocks; 13736 free (35
> chunks); 62892632 used

The introduction of the ProjectSet node has caused the regressionin
the executor visibly. A bisect run is showing me this commit as the
culprit
commit 69f4b9c85f168ae006929eec44fc44d569e846b9
Author: Andres Freund <andres@anarazel.de>
Date:   Wed Jan 18 12:46:50 2017 -0800
Move targetlist SRF handling from expression evaluation to new executor node.

I was expecting a leak of some kind first, but valgrind does not
complain when executing the query eating all the memory. Before this
commit the memory usage remains low and stable, less than 1% in my
environments.
-- 
Michael


Commits

  1. Fix intra-query memory leakage in nodeProjectSet.c.

  2. Move targetlist SRF handling from expression evaluation to new executor node.