From: | Kuntal Ghosh <kuntalghosh(dot)2007(at)gmail(dot)com> |
---|---|
To: | 张连壮 <zlianzhuang(at)163(dot)com> |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> |
Subject: | Re: Re: BUG #15801: pg_stat_database update stats_reset only by pg_stat_reset |
Date: | 2019-05-13 08:51:42 |
Message-ID: | CAGz5QC+qcFaG118rKhinNMYF4wY7eHT=gPbKr1rngtWbJNrKrw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Mon, May 13, 2019 at 2:01 PM 张连壮 <zlianzhuang(at)163(dot)com> wrote:
> yes, It'll not reset the database statistics, but the column stats_reset
> of pg_stat_database is reset.
>
> 在 2019-05-13 16:23:54,"Kuntal Ghosh" <kuntalghosh(dot)2007(at)gmail(dot)com> 写道:
>
> On Mon, May 13, 2019 at 12:46 PM PG Bug reporting form <
> noreply(at)postgresql(dot)org> wrote:
>
>>
>> pg_stat_reset_single_table_counters/pg_stat_reset_single_function_counters
>> only update pg_stat_database column stats_reset.
>> stat_reset shuld update when all the column is reset.
>>
> pg_stat_reset_single_table_counters resets the stats of a single table.
> From your example, it resets the following stats:
>
> select * from pg_stat_all_tables where relid='lzzhang_tab'::regclass::oid;
>
> It'll not reset the database statistics.
>
> It seems from the code in pgstat_recv_resetsinglecounter that whenever any
individual object inside the database is reset, the stats_reset of
pg_stat_database view is updated. This behaviour got introduced by the
following commit:
commit 4c468b37a281941afd3bf61c782b20def8c17047
Track last time for statistics reset on databases and bgwriter
Tracks one counter for each database, which is reset whenever
the statistics for any individual object inside the database is
reset, and one counter for the background writer.
So, the behaviour seems to be intentional. But, the documents of
pg_stat_database doesn't convey this behaviour properly.
stats_reset timestamp with time zone Time at which these statistics were
last reset
IMHO, the actual behaviour is stats_reset is the time at which either any
pg_stat_database statistic of a database is updated or any statistic of any
object inside the database is updated.
--
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | PG Bug reporting form | 2019-05-13 08:56:54 | BUG #15802: Comparison of a function returning boolean value using relational (<, >, <= or >=) operator |
Previous Message | Kuntal Ghosh | 2019-05-13 08:23:54 | Re: BUG #15801: pg_stat_database update stats_reset only by pg_stat_reset |