如何在Postgres中查看Autovacuum的当前设置?


36

我已经找到了一百万个有关如何设置Autovacuum的配置设置的示例,但是似乎找不到如何列出当前配置的示例。

Postgres 9.1是我最感兴趣的版本。

Answers:


51

对于常规设置,请使用:

select *
from pg_settings 
where name like '%autovacuum%'

有关表的特定设置,请查看reloptionspg_class中的列:

select relname, reloptions
from pg_class

您可能希望将其连接到pg_namespace,以将其限制为特定的模式。需要在隐藏的col上pg_namespace.oid加入的地方(添加9.3+)。

select relname, reloptions, pg_namespace.nspname
from pg_class
join pg_namespace on pg_namespace.oid = pg_class.relnamespace
where relname like 'data%' and pg_namespace.nspname = 'public';

2
另类查询:select * from pg_settings where category like 'Autovacuum'
若昂·波特拉


like 'autovacuum%'是错了,它应该是like '%autovacuum%',并不是所有的自动清理设置字开始autovacuum
Giacomo Alzetta
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.