Cli*_*chl 43 unix postgresql autovacuum
如何判断Postgres 9.x中的autovacuum守护进程是否正在运行并维护数据库集群?
Cli*_*chl 76
这特定于UNIX上的Postgres 9.3.对于Windows,请参阅此问题.
SELECT
schemaname, relname,
last_vacuum, last_autovacuum,
vacuum_count, autovacuum_count -- not available on 9.0 and earlier
FROM pg_stat_user_tables;
Run Code Online (Sandbox Code Playgroud)
$ ps -axww | grep autovacuum
24352 ?? Ss 1:05.33 postgres: autovacuum launcher process (postgres)
Run Code Online (Sandbox Code Playgroud)
# grep autovacuum /var/log/postgresql
LOG: autovacuum launcher started
LOG: autovacuum launcher shutting down
Run Code Online (Sandbox Code Playgroud)
如果您想了解有关autovacuum活动的更多信息,请设置log_min_messages为DEBUG1..DEBUG5.SQL命令VACUUM VERBOSE将在日志级别输出信息INFO.
关于Autovacuum Daemon,Posgres文档指出:
在默认配置中,启用自动清理并相应地配置相关配置参数.
也可以看看:
Cha*_*oza 14
我正在使用:
select count(*) from pg_stat_activity where query like 'autovacuum:%';
Run Code Online (Sandbox Code Playgroud)
在collectd中知道有多少autovacuum同时运行.
您可能需要创建这样的安全功能:
CREATE OR REPLACE FUNCTION public.pg_autovacuum_count() RETURNS bigint
AS 'select count(*) from pg_stat_activity where query like ''autovacuum:%'';'
LANGUAGE SQL
STABLE
SECURITY DEFINER;
Run Code Online (Sandbox Code Playgroud)
并从collectd调用它.
在早期的Postgres中,"query"是"current_query",所以根据什么有效来改变它.
| 归档时间: |
|
| 查看次数: |
34090 次 |
| 最近记录: |