pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <mail@joeconway.com>
To: Don Seiler <don@seiler.us>
To: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Why is my table not autovacuuming?
Date: Mon, 28 Aug 2017 08:59:37 -0700
Message-ID: <ea2474b3-82d8-3eb1-e781-a1ac54c7e11a@joeconway.com> (raw)
In-Reply-To: <CAHJZqBAaXKi2+n4zNFYkjOCLY+ABpuC_BSMBKHfHfs0QqPNjbA@mail.gmail.com>
References: <CAHJZqBAaXKi2+n4zNFYkjOCLY+ABpuC_BSMBKHfHfs0QqPNjbA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

On 08/28/2017 08:43 AM, Don Seiler wrote:
> PostgreSQL 9.2.18. I have a table with 71M rows (via select count). In
> pg_stat_activity, n_live_tups is 170K, n_dead_tups is slightly more than
> that (203K). The autovacuum parameter is on, the scale factor is 0.2
> (default) and threshold is 50 (default), autovacuum_max_workers is 3.
> There are no custom autovacuum thresholds set for this table. The
> last_autovacuum field is null.

<snip>

> Wondering why my autovacuum daemon appears to be acting lazily?

Autovac will kick in at (threshold + (scale_factor x 71M)), i.e. about
14.2 million dead rows. You are currently nowhere close to that.

That said, the default scale_factor is not good to such a large table.
Reduce it significantly. I often will find it necessary to use custom
values for large tables. One strategy I have used is scale_factor = 0
and threshold = <num_dead_rows_max_desired>.

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (14+ messages)  latest in thread

Message-ID: <ea2474b3-82d8-3eb1-e781-a1ac54c7e11a@joeconway.com>
Permalink:  ../ea2474b3-82d8-3eb1-e781-a1ac54c7e11a@joeconway.com/
Also on:    postgresql.org/message-id/ea2474b3-82d8-3eb1-e781-a1ac54c7e11a@joeconway.com

 · 

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-admin@postgresql.org
  Cc: mail@joeconway.com, don@seiler.us
  Subject: Re: Why is my table not autovacuuming?
  In-Reply-To: <ea2474b3-82d8-3eb1-e781-a1ac54c7e11a@joeconway.com>

* 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