pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Kirkwood <mark.kirkwood@catalyst.net.nz>
To: pgsql-performance@postgresql.org
Subject: Re: Postgres becoming slow, only full vacuum fixes it
Date: Tue, 25 Sep 2012 11:08:34 +1200
Message-ID: <5060E7F2.3010903@catalyst.net.nz> (raw)
In-Reply-To: <D15ECA12-8D6E-4E53-A294-5E175564CA61@gmail.com>
References: <D15ECA12-8D6E-4E53-A294-5E175564CA61@gmail.com>

On 24/09/12 22:33, Kiriakos Tsourapas wrote:
> Hi,
>
> The problem : Postgres is becoming slow, day after day, and only a full vacuum fixes the problem.
>
>
>
> My postgresql.conf file :
> ======================
> port = 5433                             # (change requires restart)
> max_connections = 100                   # (change requires restart)
> shared_buffers = 256MB                  # min 128kB. DoubleIP - Default was 32MB
> synchronous_commit = off                # immediate fsync at commit. DoubleIP - Default was on
> effective_cache_size = 512MB            # DoubleIP - Default was 128MB
> log_destination = 'stderr'              # Valid values are combinations of
> logging_collector = on                  # Enable capturing of stderr and csvlog
> silent_mode = on                        # Run server silently.
> log_line_prefix = '%t %d %u '           # special values:
> log_autovacuum_min_duration = 0         # -1 disables, 0 logs all actions and
> autovacuum_naptime = 28800              # time between autovacuum runs. DoubleIP - default was 1min
> autovacuum_vacuum_threshold = 100       # min number of row updates before
> autovacuum_vacuum_scale_factor = 0.0    # fraction of table size before vacuum. DoubleIP - default was 0.2
> datestyle = 'iso, mdy'
> lc_messages = 'en_US.UTF-8'                     # locale for system error message
> lc_monetary = 'en_US.UTF-8'                     # locale for monetary formatting
> lc_numeric = 'en_US.UTF-8'                      # locale for number formatting
> lc_time = 'en_US.UTF-8'                         # locale for time formatting
> default_text_search_config = 'pg_catalog.english'
>

Given that vacuum full fixes the issue I suspect you need to have 
autovacuum set wake up much sooner, not later. So autovacuum_naptime = 
28800 or even = 60 (i.e the default) is possibly too long. We have 
several database here where I change this setting to 10 i.e:

autovacuum_naptime = 10s


in order to avoid massive database bloat and queries that get slower and 
slower...

You might want to be a bit *less* aggressive with 
autovacuum_vacuum_scale_factor - I usually have this at 0.1, i.e:

autovacuum_vacuum_scale_factor = 0.1


otherwise you will be vacuuming all the time - which is usually not what 
you want (not for all your tables anyway).

regards

Mark




view thread (24+ messages)  latest in thread

Message-ID: <5060E7F2.3010903@catalyst.net.nz>
Permalink:  ../5060E7F2.3010903@catalyst.net.nz/
Also on:    postgresql.org/message-id/5060E7F2.3010903@catalyst.net.nz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: mark.kirkwood@catalyst.net.nz
  Subject: Re: Postgres becoming slow, only full vacuum fixes it
  In-Reply-To: <5060E7F2.3010903@catalyst.net.nz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox