Re: Extension Enhancement: Buffer Invalidation in pg_buffercache - Mailing list pgsql-hackers

From jian he
Subject Re: Extension Enhancement: Buffer Invalidation in pg_buffercache
Date
Msg-id CACJufxGimJaujnF2O1f=NRW6yeORx4bP1=RSVMQ46Lc8Gmqf3Q@mail.gmail.com
Whole thread Raw
In response to Re: Extension Enhancement: Buffer Invalidation in pg_buffercache  (Thomas Munro <thomas.munro@gmail.com>)
List pgsql-hackers


On Sat, Jul 1, 2023 at 6:09 AM Thomas Munro <thomas.munro@gmail.com> wrote:
>
>
> It should be restricted by role, but I wonder which role it should be.
> Testing for superuser is now out of fashion.
>

as pg_buffercache/pg_buffercache--1.2--1.3.sql. You need pg_maintain privilege to use pg_buffercache.
The following query works on a single user. Obviously you need a role who can gain pg_monitor privilege.

begin;
create role test login nosuperuser;
grant select, insert on onek to test;
grant pg_monitor to test;
set role test;
select count(*) from onek;
insert into onek values(default);
(SELECT count(*) FROM pg_buffercache WHERE relfilenode = pg_relation_filenode('onek'::regclass))
except
(
select count(pg_buffercache_invalidate(bufferid))
from    pg_buffercache   where relfilenode = pg_relation_filenode('onek'::regclass)
);

rollback;

pgsql-hackers by date:

Previous
From: Soumyadeep Chakraborty
Date:
Subject: Re: brininsert optimization opportunity
Next
From: torikoshia
Date:
Subject: Make --help output fit within 80 columns per line