Re: Unifying VACUUM VERBOSE and log_autovacuum_min_duration output - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: Unifying VACUUM VERBOSE and log_autovacuum_min_duration output
Date
Msg-id 20211130041911.GS17618@telsasoft.com
Whole thread Raw
In response to Re: Unifying VACUUM VERBOSE and log_autovacuum_min_duration output  (Peter Geoghegan <pg@bowt.ie>)
Responses Re: Unifying VACUUM VERBOSE and log_autovacuum_min_duration output
List 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



pgsql-hackers by date:

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