Subject: Do stuck replication slots prevent autovacuum of running entirely?

From: Marcelo Fernandes <[email-masked]>
Date: Wed, 21 May 2025 16:34:22 +1200

Hi there,

I am trying to understand if a stuck replication slot would be sufficient to
stop an autovacuum of even starting.

Couldn't the autovacuum process start, but fail to remove dead tuples that
are still necessary by the replication slot? Why would it prevent autovacuum
of even starting instead?

Thanks.

---

From: Laurenz Albe <[email-masked]>
Date: Wed, 21 May 2025 08:05:19 +0200

> of even starting instead?

I cannot think of a reason why an abandoned replication slot (not sure what
you mean with "stuck") would keep an autovacuum worker from starting.

Typical reasons why autovacuum doesn't start running on a table are:

- there are already "autovacuum_max_workers" worker processes running

- the thresholds for dead or inserted tuples have not been crossed

- the statistics collector has a problem and doesn't gather statistics;
  this applies mostly to v14 and older, see
  https://www.cybertec-postgresql.com/en/stale-statistics-cause-table-bloat/

- the parameter "track_activities" was disabled, so that PostgreSQL doesn't
  collect statistics

- the functions "pg_stat_reset" or "pg_stat_reset_single_table_counters"
  are called repeatedly and wipe out table statistics

Yours,
Laurenz Albe