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 1likRk-0002Rv-HL for pgsql-hackers@arkaria.postgresql.org; Mon, 17 May 2021 21:06:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1likRj-0006Qu-BN for pgsql-hackers@arkaria.postgresql.org; Mon, 17 May 2021 21:06:39 +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 1likRj-0006Qm-3e for pgsql-hackers@lists.postgresql.org; Mon, 17 May 2021 21:06:39 +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 1likRh-0007jv-4Q for pgsql-hackers@postgresql.org; Mon, 17 May 2021 21:06:38 +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 14HL6WEg2854988; Mon, 17 May 2021 17:06:32 -0400 From: Tom Lane To: Andres Freund cc: pgsql-hackers@postgresql.org, Dilip Kumar , Robert Haas Subject: Re: Move pg_attribute.attcompression to earlier in struct for reduced size? In-reply-to: <20210517204803.iyk5wwvwgtjcmc5w@alap3.anarazel.de> References: <20210517204803.iyk5wwvwgtjcmc5w@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 17 May 2021 13:48:03 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2854986.1621285592.1@sss.pgh.pa.us> Date: Mon, 17 May 2021 17:06:32 -0400 Message-ID: <2854987.1621285592@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > If we moved attcompression to all the other bool/char fields, we'd avoid > that size increase, as there's an existing 2 byte hole. +1. Looks to me like its existing placement was according to the good old "add new things at the end" anti-pattern. It certainly isn't related to the adjacent fields. Putting it just after attalign seems like a reasonably sane choice from the standpoint of grouping things affecting physical storage; and as you say, that wins from the standpoint of using up alignment padding rather than adding more. Personally I'd think the most consistent order in that area would be attbyval, attalign, attstorage, attcompression; but perhaps it's too late to swap the order of attstorage and attalign. regards, tom lane