Thread: autovacuum default run with vacuum_index_cleanup and vacuum_truncate and related lock?

autovacuum default run with vacuum_index_cleanup and vacuum_truncate and related lock?

From
"James Pang (chaolpan)"
Date:

Hi,

It’s Postgres 13 version, we plan to migrate from Oracle to Postgres 13 on RHEL8.  One maintain job is about autovacuum, with default config,  autovacuum will do on tables with  “vacuum_index_cleanup” and “vacuum_truncate” option?   With both options, autovacuum woker will hold “access exclusive” lock when truncate empty blocks and cleanup index ?  if that’s true, how to handle autovacuum to reduce the lock blocking issue?

 

Thanks,

 

James

On Mon, 2022-02-07 at 08:43 +0000, James Pang (chaolpan) wrote:
> It’s Postgres 13 version, we plan to migrate from Oracle to Postgres 13 on RHEL8.
> One maintain job is about autovacuum, with default config,  autovacuum will do on
> tables with  “vacuum_index_cleanup” and “vacuum_truncate” option?
> With both options, autovacuum woker will hold “access exclusive” lock when truncate
> empty blocks and cleanup index ?  if that’s true, how to handle autovacuum to reduce
> the lock blocking issue?

Cleaning up the index will not take any locks that block data modifications.

The ACCESS EXCLUSIVE lock for truncation is only held for a very short time
and won't bother you (unless perhaps, you could get replication conflicts on
a standby server).

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com