Re: Add pg_buffercache_evict_all() and pg_buffercache_mark_dirty[_all]() functions

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: Nazir Bilal Yavuz <byavuz81@gmail.com>
Cc: Aidar Imamov <a.imamov@postgrespro.ru>, Andres Freund <andres@anarazel.de>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, koshy44@gmail.com
Date: 2025-04-11T11:43:38Z
Lists: pgsql-hackers
On Fri, Apr 11, 2025 at 4:02 AM Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:
> I understand your point. I did it like that because bufferids start
> from 1 and go to NBuffers inclusive in the pg_buffercache view, so it
> seems more natural to me to implement it like that. I am okay to
> replace these loops with [1] to make it standart everywhere:
>
> [1]
>     for (int buf = 0; buf < NBuffers; buf++)
>     {
>         BufferDesc *desc = GetBufferDescriptor(buf);

I'm more making an observation than asking for a change. If you and
others think it should be changed, that is fine, but I'm uncertain
myself what we ought to be doing here. I just wanted to raise the
issue.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



Commits

  1. pg_buffercache: Add pg_buffercache_mark_dirty{,_relation,_all}()

  2. doc: Add missing tags in pg_buffercache page

  3. Add routines for marking buffers dirty efficiently

  4. Add pg_buffercache_evict_{relation,all} functions