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 1lm600-00085o-A4 for pgsql-hackers@arkaria.postgresql.org; Thu, 27 May 2021 02:43:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lm5zx-00034s-W6 for pgsql-hackers@arkaria.postgresql.org; Thu, 27 May 2021 02:43:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lm5zx-00034k-OV for pgsql-hackers@lists.postgresql.org; Thu, 27 May 2021 02:43:49 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lm5zv-0005ZR-PS for pgsql-hackers@postgresql.org; Thu, 27 May 2021 02:43:48 +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 14R2hg2Q1683252; Wed, 26 May 2021 22:43:42 -0400 From: Tom Lane To: Andres Freund cc: Michael Paquier , Dilip Kumar , pgsql-hackers , Robert Haas Subject: Re: Move pg_attribute.attcompression to earlier in struct for reduced size? In-reply-to: <20210527021402.b5n2sqw66y2fd6fl@alap3.anarazel.de> References: <3962395.1621609263@sss.pgh.pa.us> <20210521211929.pcehg6f23icwstdb@alap3.anarazel.de> <20210527003144.xxqppojoiwurc2iz@alap3.anarazel.de> <1677691.1622075746@sss.pgh.pa.us> <20210527015415.ctuj4yrwnjip5kve@alap3.anarazel.de> <20210527021402.b5n2sqw66y2fd6fl@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Wed, 26 May 2021 19:14:02 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1683250.1622083422.1@sss.pgh.pa.us> Date: Wed, 26 May 2021 22:43:42 -0400 Message-ID: <1683251.1622083422@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > That's not *too* bad, but also not nothing.... The memsets seem to be easy to get rid of. memset the array to zeroes *once* before entering the per-tuple loop. Then, in the loop that looks for stuff to pfree, reset any entries that are found to be set, thereby returning the array to all zeroes for the next iteration. I"m having a hard time though believing that the memset is the main problem. I'd think the pfree search loop is at least as expensive. Maybe skip that when not useful, by having a single bool flag remembering whether any columns got detoasted in this row? regards, tom lane