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 1gC9tI-0000qq-Ff for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Oct 2018 20:55:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gC9tG-00035Z-0q for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Oct 2018 20:55:02 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gC9tF-000354-Dg for pgsql-hackers@lists.postgresql.org; Mon, 15 Oct 2018 20:55:01 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gC9tB-0001Uu-HB for pgsql-hackers@postgresql.org; Mon, 15 Oct 2018 20:54:59 +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 w9FKsrFG018996; Mon, 15 Oct 2018 16:54:54 -0400 From: Tom Lane To: Andres Freund cc: pgsql-hackers@postgresql.org, Thomas Munro Subject: Re: Large writable variables In-reply-to: <20181015204557.2qqrh665cjqxvxv7@alap3.anarazel.de> References: <20181015200754.7y7zfuzsoux2c4ya@alap3.anarazel.de> <18430.1539635786@sss.pgh.pa.us> <20181015204557.2qqrh665cjqxvxv7@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Mon, 15 Oct 2018 13:45:57 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18994.1539636893.1@sss.pgh.pa.us> Date: Mon, 15 Oct 2018 16:54:53 -0400 Message-ID: <18995.1539636893@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:36:26 -0400, Tom Lane wrote: >> Andres Freund writes: >>> 0000000008585088 0000000000131104 b hist_entries >>> 0000000008716192 0000000000016384 b hist_start >> I'm unsure what fraction of processes would have use for these. > Yea, I'm not sure either. Although I suspect that given the cost of > compression having an "allocate on first use" check should be quite > doable. I don't think the extra check would be a problem, but if we end up needing the space in most processes, we're not really buying anything. It'd need some investigation. >> We could possibly fix these by changing the data structure so that >> what's in a ScanKeywords entry is an offset into some giant string >> constant somewhere. No idea how that would affect performance, but >> I do notice that we could reduce the sizeof(ScanKeyword), which can't >> hurt. > Yea, that might even help performancewise. Alternatively we could change > ScanKeyword to store the keyword name inline, but that'd be a measurable > size increase... 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. We'd need some tooling to generate the constants that way, though; I can't see how to make it directly from kwlist.h. regards, tom lane