Re: Scan buffercache for a table

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Amin <amin(dot)fallahi(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Scan buffercache for a table
Date: 2023-01-31 13:11:51
Message-ID: 20230131131151.GK22427@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2023-01-31 13:19:50 Re: [PoC] Let libpq reject unexpected authentication requests
Previous Message Sébastien Lardière 2023-01-31 13:03:29 Re: Timeline ID hexadecimal format