pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas SIMON <tsimon@neteven.com>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: Wrong stat on pg_stat_user_tables
Date: Tue, 27 Sep 2016 09:57:48 -0400
Message-ID: <31468.1474984668@sss.pgh.pa.us> (raw)
In-Reply-To: <a028c320-32bc-612a-e656-30ee153994b3@neteven.com>
References: <a028c320-32bc-612a-e656-30ee153994b3@neteven.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

Thomas SIMON <tsimon@neteven.com> writes:
> I have strange behavior with a stat of pg_stat_user_tables (explained 
> below), where number of live tuples is not the real number at all.
> ...
> I've comparated my 10 biggest tables, only this table gave me wrong results.

The pgstats stats are only approximate, but ideally they'd converge
towards reality over time when they're wrong.  Seems like maybe this one
table has a usage pattern that's odd enough to throw things off.  Maybe
you have unusual autovacuum/autoanalyze parameters for it, for example?
Is there anything strange about the way you insert/update/delete in it?

A simpler explanation might be that this table has inheritance children
--- the pgstats count would consider only the table itself, but
"select count(1) from items" would scan the child tables too.

			regards, tom lane


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



view thread (4+ messages)  latest in thread

Message-ID: <31468.1474984668@sss.pgh.pa.us>
Permalink:  ../31468.1474984668@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/31468.1474984668@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, tsimon@neteven.com
  Subject: Re: Wrong stat on pg_stat_user_tables
  In-Reply-To: <31468.1474984668@sss.pgh.pa.us>

* 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