postgresql 数据库出现 autovacuum:VACUUM xxoo.xxoo (to prevent wraparound)
os: centos 7.4db: postgresql 10.10postgresql 查看 pg_stat_activity 有时会看到 autovacuum:VACUUM xxoo.xxoo(to prevent wraparound) ,这个其实是预防事务ID会卷,原因是 postgresql 采用 32bit 事务id。版本# cat /etc/centos-releaseCe...
·
os: centos 7.4
db: postgresql 10.10
postgresql 查看 pg_stat_activity 有时会看到 autovacuum:VACUUM xxoo.xxoo(to prevent wraparound) ,这个其实是预防事务ID回卷,原因是 postgresql 采用 32bit 事务id。
版本
# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core)
#
# su - postgres
Last login: Sat Oct 26 22:55:25 CST 2019 on pts/0
$
$ psql -c "select version();"
version
----------------------------------------------------------------------------------------------------------
PostgreSQL 10.10 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit
(1 row)
when
当表的 age 大于 autovacuum_freeze_max_age时,autovacuum 进程回自动对该表进行 freeze。
autovacuum:VACUUM public.tmp_t0 (to prevent wraparound)
默认的 autovacuum_freeze_max_age 值为 200000000
postgres=# select name,setting from pg_settings where name like 'autovacuum%' order by name;
name | setting
-------------------------------------+-----------
autovacuum | on
autovacuum_analyze_scale_factor | 0.1
autovacuum_analyze_threshold | 50
autovacuum_freeze_max_age | 200000000
autovacuum_max_workers | 3
autovacuum_multixact_freeze_max_age | 400000000
autovacuum_naptime | 60
autovacuum_vacuum_cost_delay | 20
autovacuum_vacuum_cost_limit | -1
autovacuum_vacuum_scale_factor | 0.2
autovacuum_vacuum_threshold | 50
autovacuum_work_mem | -1
(12 rows)
SELECT c.oid::regclass as table_name,
greatest(age(c.relfrozenxid),age(t.relfrozenxid)) as age
from pg_class c
LEFT OUTER JOIN pg_class t ON c.reltoastrelid = t.oid
WHERE c.relkind IN ('r', 'm')
order by 2 desc
;
SELECT datname, age(datfrozenxid) FROM pg_database;
参考:
https://www.postgresql.org/docs/10/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND
更多推荐
已为社区贡献1条内容
所有评论(0)