Re: Extension Enhancement: Buffer Invalidation in pg_buffercache

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Re: Extension Enhancement: Buffer Invalidation in pg_buffercache
Дата
Msg-id CA+hUKGL_sb0qM8XeeLdeRv6HNuFXOAKj3hA_Ns4mApbK=gdFOg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Extension Enhancement: Buffer Invalidation in pg_buffercache  (Andres Freund <andres@anarazel.de>)
Ответы Re: Extension Enhancement: Buffer Invalidation in pg_buffercache
Список pgsql-hackers
On Wed, Jul 19, 2023 at 12:45 PM Andres Freund <andres@anarazel.de> wrote:
> I don't think "invalidating" is the right terminology. Note that we already
> have InvalidateBuffer() - but it's something we can't allow users to do, as it
> throws away dirty buffer contents (it's used for things like dropping a
> table).
>
> How about using "discarding" for this functionality?

+1

> Using the buffer ID as the identifier doesn't seem great, because what that
> buffer is used for, could have changed since the buffer ID has been acquired
> (via the pg_buffercache view presumably)?
>
> My suspicion is that the usual usecase for this would be to drop all buffers
> that can be dropped?

Well the idea was to be able to drop less than everything.  Instead of
having to bike-shed what the user interface should look like to
specify what subset of everything you want to drop, you can just write
SQL queries (mostly likely involving the pg_buffercache view, indeed).
It's true that buffer IDs can change underneath your feet between
SELECT and discard, but the whole concept is inherently racy like
that.  Suppose we instead had pg_unwarm('my_table') or whatever
instead.  Immediately after it runs and before it even returns, some
blocks of my_table can finish up coming back into the pool.  It's also
interesting to be able to kick individual pages out when testing code
that caches buffers IDs for ReadRecentBuffer(), and other buffer-pool
work.  Hence desire to not try to be clever at all here, and just come
up with the absolute bare minimum thing that can kick buffers out by
ID and leave the rest up to hackers/experts who are willing and able
to write queries to supply them.  You can still drop everything that
can be dropped -- generate_series.  Or whatever you want.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Extension Enhancement: Buffer Invalidation in pg_buffercache
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: pg_recvlogical prints bogus error when interrupted