Vineet Naik <naikvin@xxxxxxxxx> writes: > autovacuum is currently running and looks like it will take a few > days. But I can see logs that say, > 2021-06-11 11:53:37 UTC ERROR: database is not accepting commands to > avoid wraparound data loss in database "<dbname>" > 2021-06-11 11:53:37 UTC HINT: Stop the postmaster and vacuum that > database in single-user mode. > You might also need to commit or roll back old prepared transactions. > My question is - Should we > 1. wait and let the autovacuum run completely or > 2. interrupt autovacuum, stop postmaster and run vacuum in single-user mode? If you can afford to wait, it'd be interesting to see what happens. Looking at the code, it looks to me like what's probably happening is that those errors are coming from auto-analyze attempting to update pg_statistic. That should not, however, prevent auto-vacuum from cleaning things up and advancing the transaction threshold limit, because the catalog updates that are needed for that are nontransactional and so don't need to consume XIDs. I wonder whether we should disable auto-analyze once we get into vacuum-for-wraparound mode. But in any case, it'd be useful to see whether there's an actual bug in there. It'd also be useful to know exactly which PG version you are running. regards, tom lane