Re: set autovacuum=off

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Alessandro Gagliardi <alessandro(at)path(dot)com>
Cc: Andy Colson <andy(at)squeakycode(dot)net>, Thom Brown <thom(at)linux(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: set autovacuum=off
Date: 2012-02-23 18:01:03
Message-ID: 4F467EDF.5090708@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 02/23/2012 09:35 AM, Alessandro Gagliardi wrote:
> I should have been more clear. I virtually never delete or do updates,
> but I insert /a lot/. So the table does change quite a bit, but only
> in one direction.
>
> I was unable to disable autovacuum universally (due to the
> cant_change_runtime_param error) but I was able to disable it on
> individual tables. Still, I know this is heavy handed and sub-optimal.
> I tried set autovacuum_naptime='6min' but got the same 55P02 error.
> Should/can I set that per table?
>
> I did look at autovacuum_vacuum_threshold
> and autovacuum_vacuum_scale_factor but couldn't make sense out of
> them. (Besides, I'd probably get the same 55P02 error if I tried to
> change them.)

See:
http://www.postgresql.org/docs/current/static/runtime-config-autovacuum.html

The documentation has information like "This parameter can only be set
in the postgresql.conf file or on the server command line." that will
tell you in advance which settings will fail when you attempt to set
them through SQL statements.

But autovacuum is pretty smart about not vacuuming tables until
reasonably necessary. And beware that autovacuum is also controlling
when to analyze a table. Mass inserts are probably changing the
characteristics of your table such that it needs to be analyzed to allow
the planner to properly optimize your queries.

Have you identified that vacuum is actually causing a problem? If not,
I'd leave it alone. The system tables have a lot of information on table
vacuuming and analyzing:

select
relname,
last_vacuum,
last_autovacuum,
last_analyze,
last_autoanalyze,
vacuum_count,
autovacuum_count,
analyze_count,
autoanalyze_count
from
pg_stat_user_tables;

Cheers,
Steve

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Shaun Thomas 2012-02-23 18:05:01 Re: Very long deletion time on a 200 GB database
Previous Message Alessandro Gagliardi 2012-02-23 17:58:40 Re: set autovacuum=off