Printing page request trace from buffer manager - Mailing list pgsql-hackers

From Irodotos Terpizis
Subject Printing page request trace from buffer manager
Date
Msg-id CAEfwbXMQnPzy=Od+Kr+nUT_YWcxr_u0acOVXb7eZFqbBtcSF_w@mail.gmail.com
Whole thread Raw
List pgsql-hackers
Hello,

A description of what you are trying to achieve and what results you expect.:
I am a student and I am new in PSQL. I am working on a research project and an initial step is
to trace the page request of the buffer manager. I need to know which page was evicted from the buffer and
which page replaced it. For each request, I want to know the relation oid and the blocknumber. In the end, I want to feed this
information to a Machine learning model, that is why I it is essential for me to create an easy-to-process trace.
Initially, I modified the code within the BufferAlloc method in the bufmgr.c file,
to log the pages that were requested and were already in the cache, the pages that were evicted and the pages that 
replaced them. However, I feel that this might not be the most optimal way, as the log file is a mess and
it is hard to analyze. I was wondering if there is a more optimal way to achieve this.
PostgreSQL version number you are running: PostgreSQL 12.4, compiled by Visual C++ build 1927, 64-bit
How you installed PostgreSQL:
Downloaded the Source code from the github repository, build using
Visual Studio 2019. Changes made to the settings in the postgresql.conf file: see Server Configuration for a quick way to list them all. logging_collector = on
log_rotation_age = 0
log_min_error_statement = panic
log_error_verbosity = terse
log_statement = 'all'

Operating system and version:
Windows 10 Version 1909

I apologise if this is the wrong list to post. Please direct me to an appropriate one if you feel this question is irrelevant. Thank you for your time and help.

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Hybrid Hash/Nested Loop joins and caching results from subplans
Next
From: Li Japin
Date:
Subject: Re: About to add WAL write/fsync statistics to pg_stat_wal view