1

I found this query to see if autovacuum is diabled on a given table. I have autovacuum and statistics collector enabled on the postgresql.

SELECT reloptions FROM pg_class WHERE relname='my_table';

reloptions

----------------------------
 {autovacuum_enabled=false}

(1 row)

but what I get is just a NULL value for the given table.

Does it mean autovacuum is not enabled in any of the tables i query? please advise

Falcon
  • 47
  • 6
  • 1
    `autovacuum` runs by default on all tables. The `NULL` value is telling you that `autovacuum_enabled` has not been explicitly set to either `true` or `false` for that table and that it will be visited by `autovacuum` as needed. FYI, `autovacuum` will always check a table for transaction ID wraparound detection regardless of this setting. See here [CREATE TABLE](https://www.postgresql.org/docs/11/sql-createtable.html)*Storage Parameters ... autovacuum_enabled, toast.autovacuum_enabled (boolean)* for more information. – Adrian Klaver Aug 09 '22 at 21:02
  • 3
    If you want to verify query the *Table 28.13. pg_stat_all_tables View* from here [pg_statistics](https://www.postgresql.org/docs/11/monitoring-stats.html#PG-STAT-ALL-TABLES-VIEW). It will show the `VACUUM` and `AUTOVACUUM` information for a table. – Adrian Klaver Aug 09 '22 at 21:07

0 Answers0