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 1gsWHh-0001t6-PY for pgsql-bugs@arkaria.postgresql.org; Sat, 09 Feb 2019 17:19:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gsWHg-0005GG-Co for pgsql-bugs@arkaria.postgresql.org; Sat, 09 Feb 2019 17:19:20 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gsWHg-0005D7-33 for pgsql-bugs@lists.postgresql.org; Sat, 09 Feb 2019 17:19:20 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gsWHd-0002oh-I2 for pgsql-bugs@lists.postgresql.org; Sat, 09 Feb 2019 17:19:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x19HJ8nt024397; Sat, 9 Feb 2019 12:19:08 -0500 From: Tom Lane To: Andres Freund cc: pgsql-bugs@lists.postgresql.org, amdmi3@amdmi3.ru, Andrew Gierth , Jakub =?utf-8?Q?Jane=C4=8Dek?= Subject: Re: BUG #15592: Memory overuse with subquery containing unnest() and set operations (11.x regression) In-reply-to: <20190209153047.orqekxkpp6xz3gg4@alap3.anarazel.de> References: <26375.1547483080@sss.pgh.pa.us> <3935CFAF-8FD4-459E-B13F-67DFEE852028@anarazel.de> <27372.1547484627@sss.pgh.pa.us> <27649.1547485075@sss.pgh.pa.us> <20190114180423.ywhdg2iagzvh43we@alap3.anarazel.de> <20190114222838.h6r3fuyxjxkykf6t@alap3.anarazel.de> <20190209094025.a2sf2lw3zvnhtrtq@alap3.anarazel.de> <4491.1549722881@sss.pgh.pa.us> <20190209150028.fmmy3xxobh5rqfru@alap3.anarazel.de> <6147.1549724997@sss.pgh.pa.us> <20190209153047.orqekxkpp6xz3gg4@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Sat, 09 Feb 2019 07:30:47 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24395.1549732748.1@sss.pgh.pa.us> Date: Sat, 09 Feb 2019 12:19:08 -0500 Message-ID: <24396.1549732748@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2019-02-09 10:09:57 -0500, Tom Lane wrote: >> What is it you're actually hoping to do by removing this guarantee? > I think we probably can do better in master, but I don't see a good > solution that's not expensive in v11. The tuple hash table can be > created / destroyed at a prodigious rate before 317ffdfea / 356687bd825, > and I don't see a good way to get rid of needing an ExprContext created > therein. We could register a callback on the memory context to drop the > ExprContext, but unfortunately dropping ExprContexts retail isn't > particularly cheap as it has to go through a singly linked list > (something we ought to fix one day by using a doubly linked list, but > certainly not a minor release). Why not? I think converting that list into a dlist might be a perfectly reasonable thing to do. Certainly there are ABI considerations in the back branches, but we could probably dodge those adequately with the usual hack of putting the added field at the end. regards, tom lane