Re: Unifying VACUUM VERBOSE and log_autovacuum_min_duration output

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Unifying VACUUM VERBOSE and log_autovacuum_min_duration output
Date: 2021-11-30 04:19:11
Message-ID: 20211130041911.GS17618@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I think the 2nd chunk here could say "if (instrument)" like the first:

> @@ -482,8 +480,10 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
> TransactionId FreezeLimit;
> MultiXactId MultiXactCutoff;
>
> - /* measure elapsed time iff autovacuum logging requires it */
> - if (IsAutoVacuumWorkerProcess() && params->log_min_duration >= 0)
> + verbose = (params->options & VACOPT_VERBOSE) != 0;
> + instrument = (verbose || (IsAutoVacuumWorkerProcess() &&
> + params->log_min_duration >= 0));
> + if (instrument)

...

> @@ -702,12 +705,13 @@ heap_vacuum_rel(Relation rel, VacuumParams *params,
> vacrel->new_dead_tuples);
> pgstat_progress_end_command();
>
> - /* and log the action if appropriate */
> - if (IsAutoVacuumWorkerProcess() && params->log_min_duration >= 0)
> - if (IsAutoVacuumWorkerProcess() && params->log_min_duration >= 0)
> + /* Output instrumentation where appropriate */
> + if (verbose ||
> + (IsAutoVacuumWorkerProcess() && params->log_min_duration >= 0))

Autovacuum's format doesn't show the number of scanned pages ; it shows how
many pages were skipped due to frozen bit, but not how many were skipped due to
the all visible bit:

> INFO: table "public.foo": found 0 removable, 54 nonremovable row versions in 1 out of 45 pages
...
> INFO: finished vacuuming "regression.public.foo": index scans: 0
> pages: 0 removed, 45 remain, 0 skipped due to pins, 0 skipped frozen

If the format of autovacuum output were to change, maybe it's an opportunity to
show some of the stuff Jeff mentioned:

|Also, I'd appreciate a report on how many hint-bits were set, and how many
|pages were marked all-visible and/or frozen

--
Justin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2021-11-30 04:21:38 Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd
Previous Message Tom Lane 2021-11-30 04:12:35 Re: Correct handling of blank/commented lines in PSQL interactive-mode history