Re: Scan buffercache for a table - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: Scan buffercache for a table
Date
Msg-id 20230131131151.GK22427@telsasoft.com
Whole thread Raw
In response to Re: Scan buffercache for a table  (Amin <amin.fallahi@gmail.com>)
List pgsql-hackers
On Mon, Jan 30, 2023 at 08:11:30PM -0800, Amin wrote:
> Thank you Justin. I started a new thread because the context is a little
> bit different. I am no longer interested in statistics anymore. I want to
> find exact individual pages of a table which are cached and are/aren't
> dirty. pg_buffercache implements the loop, but it goes over all the
> buffers. However, I want to scan a specific table cache pages.

Check ReadBuffer*(), BufTableLookup() or loops around it like
FindAndDropRelationBuffers(), which is in the file you referenced.

> > On Mon, Jan 30, 2023 at 06:01:08PM -0800, Amin wrote:
> > > Hi,
> > >
> > > I am looking for function calls to scan the buffer cache for a table and
> > > find the cached pages. I want to find out which pages are cached and which
> > > of them are dirty. Having the relation id, how can I do that? I have gone
> > > through bufmgr.c and relcache.c, but could not find a way to get
> > > relation-specific pages from the buffer cache.



pgsql-hackers by date:

Previous
From: Sébastien Lardière
Date:
Subject: Re: Timeline ID hexadecimal format
Next
From: Aleksander Alekseev
Date:
Subject: Re: [PoC] Let libpq reject unexpected authentication requests