Re: Introduce some randomness to autovacuum

Поиск
Список
Период
Сортировка
От Junwang Zhao
Тема Re: Introduce some randomness to autovacuum
Дата
Msg-id CAEG8a3LvTV4fRcckidTd21Tjm3JHzZHUn97vbP9z817-T8JZ=Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Introduce some randomness to autovacuum  (Nikita Malakhov <hukutoc@gmail.com>)
Ответы Re: Introduce some randomness to autovacuum
Список pgsql-hackers
Hi Nikita, wenhui,

On Fri, Apr 25, 2025 at 11:16 PM Nikita Malakhov <hukutoc@gmail.com> wrote:
>
> Hi!
>
> I agree it is a good idea to shift the table list. Although vacuuming larger tables first
> is a questionable approach because smaller ones could wait a long time to be vacuumed.
> It looks like the most obvious and simple way is that the first table to be vacuumed
> should not be the first one from the previous iteration.
>
> On Fri, Apr 25, 2025 at 6:04 PM wenhui qiu <qiuwenhuifx@gmail.com> wrote:
>>
>> Hi,I like your idea,It would be even better if the weights could be taken according to the larger tables
>>
>
> --
> Regards,
> Nikita Malakhov
> Postgres Professional
> The Russian Postgres Company
> https://postgrespro.ru/


Thanks for your feedback.

I ended up with adding a guc configuration that may support different vacuum
strategies. I name it as `autovacuum_vacuum_strategy` but you might have
a better one. For now it support only two strategies:

1. Sequential: Tables are vacuumed in the order they are collected.
2. Random: The list of tables is rotated around a randomly chosen
       pivot before vacuuming to avoid always starting with the same
       table, which prevents vacuuming starvation for some tables.

We can extend this strategy like prioritization and whatever algorithms
in the future.

--
Regards
Junwang Zhao

Вложения

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