Re: Switch PgStat_HashKey.objoid from Oid to uint64 - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: Switch PgStat_HashKey.objoid from Oid to uint64
Date
Msg-id ZuO5gURkYTxdvVz5@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
In response to Re: Switch PgStat_HashKey.objoid from Oid to uint64  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
Hi,

On Fri, Sep 13, 2024 at 07:34:21AM +0900, Michael Paquier wrote:
> On Thu, Sep 12, 2024 at 01:37:52PM +0000, Bertrand Drouvot wrote:
> > There is also some manipulation around the 2 new uint32 fields (objid_hi and
> > objid_lo) in the xactdesc.c and pgstat_xact.c files that look good to me.
> 
> Thanks for the reviews.  The high and low manipulations are still kind
> of OK to me as a solution for the record constructions.

Agree.

> > But now we end up having functions that accept Oid as parameters to call
> > functions that accept uint64 as parameter (for the exact same parameter), for
> > example:
> > 
> > "
> > void
> > pgstat_create_function(Oid proid)
> > {
> >     pgstat_create_transactional(PGSTAT_KIND_FUNCTION,
> >                                 MyDatabaseId,
> >                                 proid);
> > }
> > "
> > 
> > as pgstat_create_transactional is now:
> > 
> > -pgstat_create_transactional(PgStat_Kind kind, Oid dboid, Oid objoid)
> > +pgstat_create_transactional(PgStat_Kind kind, Oid dboid, uint64 objid)
> > 
> > That's not an issue as both are unsigned and as we do those calls in that
> > order (Oid -> uint64).
> 
> Yes, that's intentional.  All the pgstats routines associated to a
> particular object that depends on an OID should still use an OID, and
> anything that's generic enough to be used for all stats kinds had
> better use a uint64.

Yeah, that sounds good to me.

> I was wondering if it would be better hiding
> that behind a dedicated type, but decided to stick with uint64.

That makes sense to me.

Overall, the patch LGTM.

Regards,

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



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Pgstattuple on Sequences: Seeking Community Feedback on Potential Patch
Next
From: Bertrand Drouvot
Date:
Subject: Re: per backend I/O statistics