psql -d appdb -c "SELECT datname, age(datfrozenxid) FROM pg_database;"
Check transaction ID age per database
age() reports how many transactions elapsed since the database's frozen XID, the wraparound counter. Values approaching two billion force emergency autovacuum; below about one billion is the alerting zone. The oldest database drives the whole cluster's vacuum load.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.