How to prevent autovacuum for table in Postgres
Asked Answered
D

1

6

I have big tables in which I have only inserts and selects, so when autovacuum for this tables is running - system is very slow. I have switch off autovacuum for specific tables:

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);

After this (some time after) I see:

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)

What shell I do to switch autovacuuming for this tables at all ??

Desiderate answered 4/11, 2014 at 19:49 Comment(0)
H
9

The key here is:

(to prevent wraparound)

This means Postgres must autovacuum in order to free up transaction identifiers.

You can not entirely disable this type of autovacuum, but you can reduce its frequency by tuning the autovacuum_freeze_max_age and vacuum_freeze_min_age parameters.

Headed answered 4/11, 2014 at 19:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.