Re: Extension Enhancement: Buffer Invalidation in pg_buffercache

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Palak Chaturvedi <chaturvedipalak1911(at)gmail(dot)com>, Japin Li <japinli(at)hotmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Extension Enhancement: Buffer Invalidation in pg_buffercache
Date: 2023-07-05 01:14:59
Message-ID: CACJufxGimJaujnF2O1f=NRW6yeORx4bP1=RSVMQ46Lc8Gmqf3Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jul 1, 2023 at 6:09 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)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;

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message torikoshia 2023-07-05 01:47:19 Make --help output fit within 80 columns per line
Previous Message Soumyadeep Chakraborty 2023-07-05 00:35:15 Re: brininsert optimization opportunity