We've discussed this internally many times, but today finally decided to write up a doc patch.
Autovacuum holds a SHARE UPDATE EXCLUSIVE lock, but other processes can cancel autovacuum if blocked by that lock unless the autovacuum is to prevent wraparound.This can result in very surprising behavior: imagine a system that needs to run ANALYZE manually before batch jobs to ensure reasonable query plans. That ANALYZE will interrupt attempts to run autovacuum, and pretty soon the table is far more bloated than expected, and query plans (ironically) degrade further. Attached is a patch to document that behavior (as opposed to just in the code at src/backend/storage/lmgr/proc.c:1320-1321). James Coleman
autovacuum-interruption-v1.patch
Description: Binary data