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: Phil Frost <phil@postmates.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Why is my table not autovacuuming?
Date: Mon, 28 Aug 2017 09:13:03 -0700
Message-ID: <73557173-6cdb-6318-c7a5-e531d385e397@joeconway.com> (raw)
In-Reply-To: <CAHJZqBAwDCsznV03OA8V7n7bKfJhx9Dx-fgmp8RLXfqdQJzq5w@mail.gmail.com>
References: <CAHJZqBAaXKi2+n4zNFYkjOCLY+ABpuC_BSMBKHfHfs0QqPNjbA@mail.gmail.com>
	<CAC6ry0+NJMoKXxn9KQxcj+GP_DoMynxa6etxc7wVC3B2Mh1zZA@mail.gmail.com>
	<CAHJZqBAwDCsznV03OA8V7n7bKfJhx9Dx-fgmp8RLXfqdQJzq5w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

On 08/28/2017 08:59 AM, Don Seiler wrote:
> So the autovacuum daemon knows that there are 71M rows, even though
> pg_stat_all_tables said only 170K? Is it using pg_class.reltuples? Is
> pg_stat_all_tables not really a reliable source of stats information?

See:
file:///opt/src/pgsql-git/master/src/backend/postmaster/autovacuum.c

 * threshold = vac_base_thresh + vac_scale_factor * reltuples

pg_stat_all_tables only shows information known by the stats collector,
which only knows about activity since the last stats reset (which can
happen, for example on "immediate" shutdown or server crash), not
absolute numbers (although reltuples is only an estimate too).

-- 
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: <73557173-6cdb-6318-c7a5-e531d385e397@joeconway.com>
Permalink:  ../73557173-6cdb-6318-c7a5-e531d385e397@joeconway.com/
Also on:    postgresql.org/message-id/73557173-6cdb-6318-c7a5-e531d385e397@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, phil@postmates.com
  Subject: Re: Why is my table not autovacuuming?
  In-Reply-To: <73557173-6cdb-6318-c7a5-e531d385e397@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