Re: Allow single table VACUUM in transaction block - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: Allow single table VACUUM in transaction block
Date
Msg-id 20221027200742.GE16921@telsasoft.com
Whole thread Raw
In response to Allow single table VACUUM in transaction block  (Simon Riggs <simon.riggs@enterprisedb.com>)
Responses Re: Allow single table VACUUM in transaction block  (Simon Riggs <simon.riggs@enterprisedb.com>)
List pgsql-hackers
On Thu, Oct 27, 2022 at 10:31:31AM +0100, Simon Riggs wrote:
> Allows both ANALYZE and vacuum of toast tables, but not VACUUM FULL.

Maybe I misunderstood what you meant: you said "not VACUUM FULL", but
with your patch, that works:

postgres=# begin; VACUUM FULL pg_class; commit;
BEGIN
VACUUM
COMMIT

Actually, I've thought before that it was bit weird that CLUSTER can be
run within a transaction, but VACUUM FULL cannot (even though it does a
CLUSTER behind the scenes).  VACUUM FULL can process multiple relations,
whereas CLUSTER can't, but it seems nice to allow vacuum full for the
case of a single relation.

I haven't checked the rest of the patch, but +1 for allowing VACUUM FULL
within a user txn.

Maybe the error message needs to be qualified "...when multiple
relations are specified".

ERROR:  VACUUM cannot run inside a transaction block

-- 
Justin



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Reducing planning time on tables with many indexes
Next
From: David Rowley
Date:
Subject: Re: Have nodeSort.c use datum sorts single-value byref types