Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gCAGf-0001so-DA for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Oct 2018 21:19:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gCAGd-0001uk-KC for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Oct 2018 21:19:11 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1gCAGd-0001ua-Cp for pgsql-hackers@lists.postgresql.org; Mon, 15 Oct 2018 21:19:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gCAGb-0004T3-BS for pgsql-hackers@postgresql.org; Mon, 15 Oct 2018 21:19:10 +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 w9FLJ3mx021010; Mon, 15 Oct 2018 17:19:03 -0400 From: Tom Lane To: Andres Freund cc: pgsql-hackers@postgresql.org, Thomas Munro Subject: Re: Large writable variables In-reply-to: <20181015210259.3n7enpwlw3iy3apy@alap3.anarazel.de> References: <20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de> <18430.1539635786@sss.pgh.pa.us> <20181015204557.2qqrh665cjqxvxv7@alap3.anarazel.de> <18995.1539636893@sss.pgh.pa.us> <20181015210259.3n7enpwlw3iy3apy@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 15 Oct 2018 14:02:59 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21008.1539638343.1@sss.pgh.pa.us> Date: Mon, 15 Oct 2018 17:19:03 -0400 Message-ID: <21009.1539638343@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2018-10-15 16:54:53 -0400, Tom Lane wrote: >> Yeah. It also seems like doing it this way would improve locality of >> access: the pieces of the giant string would presumably be in the same >> order as the ScanKeywords entries, whereas with the current setup, >> who knows where the compiler has put 'em or in what order. > I assume you're talking about the offset approach. Performancewise I > assume that my suggestion of inlining the names into the struct would be > faster. Are there many realistic cases where performance matters enough > to warrant the size increase? Doubt it, because there'd be an awful lot of wasted space due to the need to set the struct size large enough for the longest keyword. (Plus it would likely not come out to be a power-of-2 size, slowing array indexing.) If you want this to be cache-friendly, I'd think the smaller the better. regards, tom lane