Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oVMRP-0000PV-VY for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Sep 2022 00:27:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oVMRN-0000d6-L9 for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Sep 2022 00:27:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oVMRN-0000cw-Bp for pgsql-hackers@lists.postgresql.org; Tue, 06 Sep 2022 00:27:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oVMRH-0007F2-3G for pgsql-hackers@lists.postgresql.org; Tue, 06 Sep 2022 00:27:44 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 2860RYBr3000302; Mon, 5 Sep 2022 20:27:34 -0400 From: Tom Lane To: David Rowley cc: Andres Freund , Robert Haas , Yura Sokolov , PostgreSQL Developers Subject: Re: Reducing the chunk header sizes on all memory context types In-reply-to: References: <20220809184410.g6yzu6pvttuphag5@awork3.anarazel.de> <20220905230949.kb3x2fkpfwtngz43@awork3.anarazel.de> Comments: In-reply-to David Rowley message dated "Tue, 06 Sep 2022 12:10:21 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3000300.1662424054.1@sss.pgh.pa.us> Date: Mon, 05 Sep 2022 20:27:34 -0400 Message-ID: <3000301.1662424054@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk David Rowley writes: > On Tue, 6 Sept 2022 at 11:09, Andres Freund wrote: >> I was looking at >> MemoryContextContains(). Unless I am missing something, the patch omitted >> adjusting that? We'll probably always return false right now. > Oops. Yes. I'll push a fix a bit later. The existing uses in nodeAgg and nodeWindowAgg failed to expose this because an incorrect false result just causes them to do extra work (ie, a useless datumCopy). I think there might be a memory leak too, but the regression tests wouldn't run an aggregation long enough to make that obvious either. +1 for adding something to regress.c that verifies that this works properly for all three allocators. I suggest making three contexts and cross-checking the correct results for all combinations of chunk A vs context B. regards, tom lane