Re: Autovacuum on partitioned table (autoanalyze)

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Autovacuum on partitioned table (autoanalyze)
Дата
Msg-id 20210408032235.GA6842@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: Autovacuum on partitioned table (autoanalyze)  (yuzuko <yuzukohosoya@gmail.com>)
Ответы Re: Autovacuum on partitioned table (autoanalyze)
Re: Autovacuum on partitioned table (autoanalyze)
Re: Autovacuum on partitioned table (autoanalyze)
Список pgsql-hackers
OK, I bit the bullet and re-did the logic in the way I had proposed
earlier in the thread: do the propagation on the collector's side, by
sending only the list of ancestors: the collector can read the tuple
change count by itself, to add it to each ancestor.  This seems less
wasteful.  Attached is v16 which does it that way and seems to work
nicely under my testing.

However, I just noticed there is a huge problem, which is that the new
code in relation_needs_vacanalyze() is doing find_all_inheritors(), and
we don't necessarily have a snapshot that lets us do that.  While adding
a snapshot acquisition at that spot is a very easy fix, I hesitate to
fix it that way, because the whole idea there seems quite wasteful: we
have to look up, open and lock every single partition, on every single
autovacuum iteration through the database.  That seems bad.  I'm
inclined to think that a better idea may be to store reltuples for the
partitioned table in pg_class.reltuples, instead of having to add up the
reltuples of each partition.  I haven't checked if this is likely to
break anything.

(Also, a minor buglet: if we do ANALYZE (col1), then ANALYZE (col2) a
partition, then we repeatedly propagate the counts to the parent table,
so we would cause the parent to be analyzed more times than it should.
Sounds like we should not send the ancestor list when a column list is
given to manual analyze.  I haven't verified this, however.)

-- 
Álvaro Herrera       Valdivia, Chile
Syntax error: function hell() needs an argument.
Please choose what hell you want to involve.

Вложения

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

Предыдущее
От: Masahiko Sawada
Дата:
Сообщение: Re: Set access strategy for parallel vacuum workers
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: Set access strategy for parallel vacuum workers