pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: Quan Zongliang <quanzongliang@yeah.net>
To: pgsql-hackers@lists.postgresql.org
Subject: Re: Change the bool member of the Query structure to bits
Date: Tue, 20 Feb 2024 12:18:46 +0100
Message-ID: <099cc1b8-c4bd-486a-876d-35c187ee4a1d@enterprisedb.com> (raw)
In-Reply-To: <dc6fef8c-a702-43f1-8490-ed6c8408e712@yeah.net>
References: <d05a1c87-82e9-49a3-a4e2-e0d2b38b2e8b@yeah.net>
	<dc6fef8c-a702-43f1-8490-ed6c8408e712@yeah.net>

On 2/20/24 11:11, Quan Zongliang wrote:
> 
> Sorry. I forgot to save a file. This is the latest.
> 
> On 2024/2/20 18:07, Quan Zongliang wrote:
>>
>> The Query structure has an increasing number of bool attributes. This
>> is likely to increase in the future. And they have the same
>> properties. Wouldn't it be better to store them in bits? Common
>> statements don't use them, so they have little impact. This also saves
>> memory space.
>>

Hi,

Are we really adding bools to Query that often? A bit of git-blame says
it's usually multiple years to add a single new flag, which is what I'd
expect. I doubt that'll change.

As for the memory savings, can you quantify how much memory this would save?

I highly doubt that's actually true (or at least measurable). The Query
struct has ~256B, the patch cuts that to ~232B. But we allocate stuff in
power-of-2, so we'll allocate 256B chunk anyway. And we allocate very
few of those objects anyway ...

regards

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company





view thread (6+ messages)  latest in thread

Message-ID: <099cc1b8-c4bd-486a-876d-35c187ee4a1d@enterprisedb.com>
Permalink:  ../099cc1b8-c4bd-486a-876d-35c187ee4a1d@enterprisedb.com/
Also on:    postgresql.org/message-id/099cc1b8-c4bd-486a-876d-35c187ee4a1d@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tomas.vondra@enterprisedb.com, quanzongliang@yeah.net, pgsql-hackers@lists.postgresql.org
  Subject: Re: Change the bool member of the Query structure to bits
  In-Reply-To: <099cc1b8-c4bd-486a-876d-35c187ee4a1d@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox