From: Tomas Vondra <tv@fuzzy.cz>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Huang, Suya <suya.huang@au.experian.com>
Cc: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Subject: Re: huge pgstat.stat file on PostgreSQL 8.3.24
Date: Fri, 20 Jun 2014 12:14:16 +0200
Message-ID: <14a9b449f48a4990ac2c605b653323cc.squirrel@sq.gransy.com> (raw)
In-Reply-To: <CAFj8pRB_w2u0BkHzZkWjURXJV+aeNmkza_=Tg1SpKGzZZhkFQg@mail.gmail.com>
References: <D83E55F5F4D99B4A9B4C4E259E6227CD014A1351@AUX1EXC01.apac.experian.local>
<CAFj8pRAj2_Dro=h1enFiMnujFJDD-roB22ROqXPJQXDYd7nARw@mail.gmail.com>
<D83E55F5F4D99B4A9B4C4E259E6227CD014A1450@AUX1EXC01.apac.experian.local>
<CAFj8pRBTNWJ6M66AJw2woQZCDwybRzwCbctLaAJScgHZt3pT_Q@mail.gmail.com>
<D83E55F5F4D99B4A9B4C4E259E6227CD014AAC76@AUX1EXC01.apac.experian.local>
<CAFj8pRB_w2u0BkHzZkWjURXJV+aeNmkza_=Tg1SpKGzZZhkFQg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>
On 20 Červen 2014, 5:33, Pavel Stehule wrote:
> 2014-06-20 1:44 GMT+02:00 Huang, Suya <Suya.Huang@au.experian.com>:
>>
>> Thanks Pavel, to be more clear, what does " pg_stat_reset "really reset?
>> In the document it says " Reset all statistics counters for the current
>> database to zero(requires superuser privileges) ". I thought it would
>> reset all statistics of all tables/indexes, thus why I am thinking of
>> re-run analyze database to gather statistics. Because if table/indexes
>> don't have statistics, the query plan would be affected which is not a
>> good
>> thing to a production box... I'm not so sure if I understand "run
>> statistics" you mentioned here.
>>
>
> you have true - anyway you can clean a content of this directory - but if
> your database has lot of database objects, your stat file will have a
> original size very early
>
> Pavel
>
No, he's not right.
Suya, as I wrote in my previous message, there are two kinds of statistics
in PostgreSQL
a) data distribution statistics
- histograms, MCV lists, number of distinct values, ...
- stored in regular tables
- used for planning
- collected by ANALYZE
- not influenced by pg_stat_reset() at all
b) runtime statistics
- number of scans for table/index, rows fetched from table/index, ...
- tracks activity within the database
- stored in pgstat.stat file (or per-db files in the recent releases)
- used for monitoring, not for planning
- removed by pg_stat_reset()
So running pg_stat_reset will not hurt planning at all.
regards
Tomas
--
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
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: tv@fuzzy.cz, pavel.stehule@gmail.com, suya.huang@au.experian.com
Subject: Re: huge pgstat.stat file on PostgreSQL 8.3.24
In-Reply-To: <14a9b449f48a4990ac2c605b653323cc.squirrel@sq.gransy.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