Re: Wrong stat on pg_stat_user_tables - Mailing list pgsql-admin

From Tom Lane
Subject Re: Wrong stat on pg_stat_user_tables
Date
Msg-id 31468.1474984668@sss.pgh.pa.us
Whole thread Raw
In response to Wrong stat on pg_stat_user_tables  (Thomas SIMON <tsimon@neteven.com>)
Responses Re: Wrong stat on pg_stat_user_tables
List pgsql-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


pgsql-admin by date:

Previous
From: Scott Whitney
Date:
Subject: Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433
Next
From: Glyn Astill
Date:
Subject: Re: Wrong stat on pg_stat_user_tables