On Tue, Dec 31, 2024 at 2:33 AM wenhui qiu <qiuwenhu...@gmail.com> wrote:

> Of course, to observe the duration of vacuum operations, we can configure
> the log_autovacuum_min_durationparameter, but if there are many tables in
> the database, the vacuum entries in the logs might be quite numerous,
> making it difficult to analyze.
>
> Using log_autovacuum_min_duration really is the best solution here. It is
not very difficult to write a script to pull the information out. Yes, it
can be a lot of lines if there are a lot of tables, but that's part of why
it's a duration and not a toggle - you can ignore the quick-running ones.
Also, the log files give you historical overview that the pg_stat views
simply cannot provide, in addition to the actual details of what was
vacuumed and why. All that is to say that I am not convinced we need to
tweak the system views when we have the information already available in a
better way.

For what it's worth, log_autovacuum_min_duration is one of the few
parameters that I always recommend be turned on at the highest level (i.e.
log it all). The extra log verbosity is well worth it.

Cheers,
Greg

Reply via email to