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.