【问题标题】:How to prevent autovacuum for table in Postgres如何防止 Postgres 中的表自动清空
【发布时间】:2014-11-04 19:49:19
【问题描述】:

我有大表,其中只有插入和选择,所以当这个表的自动清理运行时 - 系统非常慢。我已经关闭了特定表的 autovacuum:

ALTER TABLE ag_event_20141004_20141009  SET (autovacuum_enabled = false, toast.autovacuum_enabled = false);
ALTER TABLE ag_event_20141014_20141019  SET (autovacuum_enabled = false, toast.autovacuum_enabled = false);

之后(一段时间后)我看到了:

select pid, waiting, xact_start, query_start,query from pg_stat_activity order by query_start;

 18092 | f       | 2014-11-04 22:21:05.95512+03  | 2014-11-04 22:21:05.95512+03  | autovacuum: VACUUM public.ag_event_20141004_20141009 (to prevent wraparound)
 19877 | f       | 2014-11-04 22:22:05.889182+03 | 2014-11-04 22:22:05.889182+03 | autovacuum: VACUUM public.ag_event_20141014_20141019 (to prevent wraparound)

我做了什么shell来切换这个表的自动清理?

【问题讨论】:

    标签: postgresql postgresql-9.2 autovacuum


    【解决方案1】:

    这里的关键是:

    (to prevent wraparound)
    

    这意味着 Postgres 必须自动清理才能free up transaction identifiers

    您不能完全禁用这种类型的 autovacuum,但可以通过调整 autovacuum_freeze_max_agevacuum_freeze_min_age 参数来降低其频率。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-17
      • 1970-01-01
      • 2018-06-21
      相关资源
      最近更新 更多