Re: PgStat_HashKey padding issue when passed by reference - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: PgStat_HashKey padding issue when passed by reference
Date
Msg-id aNEJqT1CKLmz7i2z@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
In response to Re: PgStat_HashKey padding issue when passed by reference  (Sami Imseih <samimseih@gmail.com>)
List pgsql-hackers
Hi,

On Thu, Sep 18, 2025 at 11:52:05AM -0500, Sami Imseih wrote:
> > I still want to add it, but it also seemed like you were not much a
> > fan of it, so I did not really want to push forward with something
> > that was not loved.  :D
> >
> > Addressing your points, attached is an updated patch labelled v2.
> 
> I was not a fan of it, when my idea was to allow flexibility in adding
> more fields to the key. However, I am now convinced objid should be
> good enough.

+ * NB: We assume that this struct contains no padding.  Also, 8 bytes
+ * allocated for the object ID are good enough to ensure the uniqueness
+ * of the hash key, hence the addition of new fields is not recommended.

yeah that would also work for [1], where the objoid could then store a spcOid
and a relNumber (so that all the RelFileLocator fields would be stored) means:

dboid (linked to RelFileLocator's dbOid)
objoid (linked to RelFileLocator's spcOid and to the RelFileLocator's relNumber)

[1]: https://www.postgresql.org/message-id/flat/ZlGYokUIlERemvpB%40ip-10-97-1-34.eu-west-3.compute.internal

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Jim Jones
Date:
Subject: Re: We broke the defense against accessing other sessions' temp tables
Next
From: Jakub Wartak
Date:
Subject: Re: postmaster uses more CPU in 18 beta1 with io_method=io_uring