Re: ReadRecentBuffer() doesn't scale well

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Re: ReadRecentBuffer() doesn't scale well
Дата
Msg-id CA+hUKGJ8N_DRSB0YioinWjS2ycMpmOLy32mbBqVVztwBvXgyJA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: ReadRecentBuffer() doesn't scale well  (Andres Freund <andres@anarazel.de>)
Ответы Re: ReadRecentBuffer() doesn't scale well  (Andres Freund <andres@anarazel.de>)
Re: ReadRecentBuffer() doesn't scale well  (vignesh C <vignesh21@gmail.com>)
Список pgsql-hackers
On Fri, Jun 30, 2023 at 3:39 AM Andres Freund <andres@anarazel.de> wrote:
> I am wondering if we don't want something more generic than stashing this in
> rd_amcache. Don't want to end up duplicating relevant code across the uses of
> rd_amcache in every AM.

I suppose we could try to track hot pages automatically.  Ants Aasma
mentioned that he was working on a tiny SIMD-based LRU that could be
useful for something like that, without being too slow.  Just for
fun/experimentation, here's a simple attempt to use a very stupid
stand-in LRU to cache the most recent 8 lookups for each fork of each
relation.  Obviously that will miss every time for many workloads so
it'd have to be pretty close to free and this code probably isn't good
enough, but perhaps Ants knows how to sprinkle the right magic fairy
dust on it.  It should automatically discover things like root pages,
the heap target block during repeat inserts etc, and visibility map
pages would stick around, and perhaps a few more pages of btrees that
have a very hot key range (but not pgbench).

> I do wonder if we should have an unlocked pre-check for a) the buffer being
> valid and b) BufferTagsEqual() matching.  With such a pre-check the race for
> increasing the usage count of the wrong buffer is quite small, without the
> pre-check it doesn't seem that small anymore.

Yeah, that makes sense.  Done in this version.

Вложения

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

Предыдущее
От: Yuya Watari
Дата:
Сообщение: Re: Making empty Bitmapsets always be NULL
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: Assert while autovacuum was executing