add PROCESS_MAIN to VACUUM

Nathan Bossart <nathandbossart@gmail.com>

From: Nathan Bossart <nathandbossart@gmail.com>
To: pgsql-hackers@postgresql.org
Date: 2022-12-30T00:00:28Z
Lists: pgsql-hackers

Attachments

Hi hackers,

I originally suggested $ЅUBJECT as part of the thread that ultimately led
to the addition of PROCESS_TOAST [0], but we decided not to proceed with
it.  Recently, this idea came up again [1], so I thought I'd give it
another try.

The motivation for adding this option is to make it easier to VACUUM only a
relation's TOAST table.  At the moment, you need to find the TOAST table by
examining a relation's reltoastrelid, and you need USAGE on the pg_toast
schema.  This option could also help make it possible to call only
vac_update_datfrozenxid() without processing any relations, as discussed
elsewhere [2].

The demand for all these niche VACUUM options is likely limited, but it
does seem like there are some useful applications.  If a new option is out
of the question, perhaps this functionality could be added to the existing
PROCESS_TOAST option.

[0] https://postgr.es/m/BA8951E9-1524-48C5-94AF-73B1F0D7857F%40amazon.com
[1] https://postgr.es/m/20221215191246.GA252861%40nathanxps13
[2] https://postgr.es/m/20221229213719.GA301584%40nathanxps13

-- 
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

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.