pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Guillaume Lelarge <guillaume@lelarge.info>
To: Josh Berkus <josh@agliodbs.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Where does data in pg_stat_user_tables come from?
Date: Thu, 16 Sep 2010 21:02:07 +0200
Message-ID: <4C9269AF.8070002@lelarge.info> (raw)
In-Reply-To: <4C92645A.1040208@agliodbs.com>
References: <4C8EAE5E.70201@agliodbs.com>
	<1284421288.28610.501.camel@jd-desktop.unknown.charter.com>
	<4C8EB813.6070204@agliodbs.com>
	<1284423128.28610.592.camel@jd-desktop.unknown.charter.com>
	<4C8EC79F.9080404@agliodbs.com>
	<1284436337-sup-9871@alvh.no-ip.org>
	<4C92645A.1040208@agliodbs.com>

Le 16/09/2010 20:39, Josh Berkus a écrit :
> 
>> It's been pure nonsense in this thread.  Please show an example of
>> what's not working.
> 
> 1) Init a postgresql 8.3 with autovacuum disabled.
> 
> 2) Load a backup of a database into that PostgreSQL.
> 
> 3) Check pg_stat_user_tables.  n_live_tup for all tables will be 0.
> 
> 4) VACUUM ANALYZE the whole database.
> 
> 5) n_live_tup will *still* be 0.  Whereas reltuples in pg_class will be
> reasonable accurate.
> 

Did all your steps (except the fourth one). Works great (meaning
n_live_tup is updated as it should be).

I have to agree with Alvarro, this is complete nonsense. VACUUM ANALYZE
doesn't change the pg_stat_*_tables columns value, the stats collector does.

If your n_live_tup didn't get updated, I'm quite sure you have
track_counts to off in your postgresql.conf file.

>> Um ... it updates the last_autovacuum and last_autoanalyze columns,
>> but the others are not its responsibility.
> 
> Right. I'm contending that ANALYZE *should* update those columns.

The postgres process executing ANALYZE surely sent this information to
the stats collector (once again, if track_counts is on). Tried it
tonight, works great too.

> Current behavior is unintuitive and makes the stats in
> pg_stat_user_tables almost useless, since you can never get even
> approximately a coherent snapshot of data for all tables.
> 

Get a look at your track_count setting.


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.com



view thread (11+ messages)  latest in thread

Message-ID: <4C9269AF.8070002@lelarge.info>
Permalink:  ../4C9269AF.8070002@lelarge.info/
Also on:    postgresql.org/message-id/4C9269AF.8070002@lelarge.info

 · 

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: guillaume@lelarge.info, josh@agliodbs.com
  Subject: Re: Where does data in pg_stat_user_tables come from?
  In-Reply-To: <4C9269AF.8070002@lelarge.info>

* 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