public inbox for [email protected]  
help / color / mirror / Atom feed
From: Bertrand Drouvot <[email protected]>
To: Kirill Reshke <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: [email protected]
Subject: Re: relfilenode statistics
Date: Fri, 3 Jan 2025 16:18:37 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<Ztk4JIgWKk/8/[email protected]>
	<Zt/[email protected]>
	<[email protected]>
	<CA+TgmoZtRxvAuMyO4bQjj5t47XWvQsowPAedkOkrCP61B7mQFg@mail.gmail.com>
	<[email protected]>
	<CALdSSPhQyvK_wsvV+HiQcC6f57Zg2WO60wxv=CXbcoZ1p5HHEQ@mail.gmail.com>
	<Z0nbomp2e/[email protected]>
	<CALdSSPhFaLEWXG9Mn8-tZoS68rE52647a2oZ6jrUNSBtwadD0A@mail.gmail.com>
	<[email protected]>

Hi,

On Tue, Dec 03, 2024 at 10:31:15AM +0000, Bertrand Drouvot wrote:
> Hi,
> 
> On Fri, Nov 29, 2024 at 08:52:13PM +0500, Kirill Reshke wrote:
> > On Fri, 29 Nov 2024 at 20:20, Bertrand Drouvot
> > <[email protected]> wrote:
> > > On Fri, Nov 29, 2024 at 11:23:12AM +0500, Kirill Reshke wrote:
> > > > If we don’t have the relation OID when writing buffers out, can we
> > > > just store oid to buffertag mapping somewhere and use it?
> > >
> > > Do you mean add the relation OID into the BufferTag? While that could probably
> > > be done from a technical point of view (with probably non negligible amount
> > > of refactoring), I can see those cons:
> > 
> > Not exactly, what i had in mind was a separate hashmap into shared
> > memory, mapping buffertag<>oid.
> 
> I see.
> 
> > > 2. Probably lot of refactoring
> > > 3. This new member would be there "only" for stats and reporting purpose as
> > > it is not needed at all for buffer related operations
> > 
> > To this design, your points 2&3 apply.
> 
> That said, it might also help for DropRelationBuffers() where we need to scan
> the entire buffer pool (there is an optimization in place though). We could
> imagine buffertag as key and the value could be the relation OID and each entry
> would have next/prev pointers linking to other BufferTags with same OID.
> 
> That's probably much more refactoring (and more invasive) that the initial idea
> in this thread but could lead to multiple pros though. I'm not very familar with
> the "buffer" area of the code and would also need to study the performance impact
> to maintain this new hash map.
> 
> Do you and/or others have any thoughts/ideas about it?

As mentioned by Andres in [1], relying on the relation OID would not work to
"recover" the stats because we don't have access to the relation oid during crash
recovery. So, I'm going to resume working on the "initial" idea (i.e having the
stats keyed by relfilenode).

[1]: https://www.postgresql.org/message-id/xvetwjsnkhx2gp6np225g2h64f4mfmg6oopkuaiivrpzd2futj%40pflk55su3...

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: relfilenode statistics
  In-Reply-To: <[email protected]>

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

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