I’ve got ‘autovacuum_freeze_max_age’ which is 200 000 000 by default.
And in theory I found a rule that autovacuum wraparound starts when:
If age(relfrozenxid) > autovacuum_freeze_max_age
But when then usual autovacuum is started? How can I count a moment:
- When usual autovacuum on a table is started?
- When autovacuum becomes autovacuum wraparound? Really after age(relfrozenxid) > autovacuum_freeze_max_age?
2
Answers
Made a query which shows the dead turple (when simple vacuum is started) and when vacuum wrapadaround:
As the documentation states, normal autovacuum is triggered
The second part applies only to PostgreSQL v13 and later.
Furthermore,
So an autovacuum worker run that was triggered by the normal mechanism can run as an anti-wraparound
VACUUM
if there are old enough rows in the table.Finally,
So if a table with old live tuples is never autovacuumed during normal processing, a special anti-wraparound autovacuum run is triggered for it, even if autovacuum is disabled. Such an autovacuum run is also forced if there are multixacts that are older than
vacuum_multixact_freeze_table_age
, see here. From PostgreSQL v14 on, if an unfrozen row in a table is older thanvacuum_failsafe_age
, an anti-wraparound autovacuum will skip index cleanup for faster processing.Yes, this is pretty complicated.