Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hVFBN-0000RE-LO for pgsql-hackers@arkaria.postgresql.org; Mon, 27 May 2019 12:56:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hVFBM-0003g7-Be for pgsql-hackers@arkaria.postgresql.org; Mon, 27 May 2019 12:56:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hVFBM-0003cJ-0u for pgsql-hackers@lists.postgresql.org; Mon, 27 May 2019 12:56:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hVFBJ-00065S-77 for pgsql-hackers@lists.postgresql.org; Mon, 27 May 2019 12:56:51 +0000 Received: from pro.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x4RCuTmr013838; Mon, 27 May 2019 08:56:31 -0400 From: Tom Lane To: Amit Langote cc: Joe Conway , David Rowley , Andreas Seltenreich , PostgreSQL Hackers Subject: Re: Excessive memory usage in multi-statement queries w/ partitioning In-reply-to: <3ed13306-ba63-f2e8-1eeb-63b0e4f377e6@lab.ntt.co.jp> References: <87ftp6l2qr.fsf@credativ.de> <0e717312-3a02-781b-7dfc-e0cc395e92d8@joeconway.com> <6014.1558708103@sss.pgh.pa.us> <3ed13306-ba63-f2e8-1eeb-63b0e4f377e6@lab.ntt.co.jp> Comments: In-reply-to Amit Langote message dated "Mon, 27 May 2019 14:58:12 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <65091.1558961789.1@sss.pgh.pa.us> Date: Mon, 27 May 2019 08:56:29 -0400 Message-ID: <65092.1558961789@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Amit Langote writes: > On 2019/05/24 23:28, Tom Lane wrote: >> So my thought, if we want to do something about this, is not "find >> some things we can pfree at the end of planning" but "find a way >> to use a separate context for each statement in the query string". > Maybe like the attached? I'm not sure if we need to likewise be concerned > about exec_sql_string() being handed multi-query strings. Please add this to the upcoming CF so we don't forget about it. (I don't think there's anything very new about this behavior, so I don't feel that we should consider it an open item for v12 --- anyone think differently?) regards, tom lane