Re: add PROCESS_MAIN to VACUUM

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, vignesh C <vignesh21@gmail.com>, pgsql-hackers@postgresql.org
Date: 2023-03-02T05:21:08Z
Lists: pgsql-hackers
On Thu, Mar 02, 2023 at 12:58:32PM +0900, Masahiko Sawada wrote:
> Cutting the toast relation name to 'pg_toast' is a bit confusing to me
> as we have the pg_toast schema. How about using the following query
> instead to improve the readability?
> 
>        SELECT
>        CASE WHEN c.relname IS NULL THEN
>        s.relname
>        ELSE
>        'toast for ' || c.relname
>        END as relname,
>        s.vacuum_count
>        FROM pg_stat_all_tables s
>        LEFT JOIN pg_class c ON s.relid = c.reltoastrelid
>        WHERE c.relname = 'vactst' OR s.relname = 'vactst'

Another tweak that I have learnt to like is to apply a filter with
regexp_replace(), see 090_reindexdb.pl:
regexp_replace(b.indname::text, '(pg_toast.pg_toast_)\\d+(_index)', '\\1<oid>\\2')

If you make that part of the view definition, the result is the same,
so that's up to which solution one prefers.
--
Michael

Commits

  1. Improve readability of code PROCESS_MAIN in vacuum_rel()

  2. Add PROCESS_MAIN to VACUUM

  3. Improve the regression tests of VACUUM (PROCESS_TOAST)

  4. Display the leader apply worker's PID for parallel apply workers.