Re: Re: BUG #15801: pg_stat_database update stats_reset only by pg_stat_reset

Поиск
Список
Период
Сортировка
От Kuntal Ghosh
Тема Re: Re: BUG #15801: pg_stat_database update stats_reset only by pg_stat_reset
Дата
Msg-id CAGz5QC+qcFaG118rKhinNMYF4wY7eHT=gPbKr1rngtWbJNrKrw@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #15801: pg_stat_database update stats_reset only by pg_stat_reset  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
On Mon, May 13, 2019 at 2:01 PM 张连壮 <zlianzhuang@163.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.2007@gmail.com> 写道:
On Mon, May 13, 2019 at 12:46 PM PG Bug reporting form <noreply@postgresql.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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Kuntal Ghosh
Дата:
Сообщение: Re: BUG #15801: pg_stat_database update stats_reset only by pg_stat_reset
Следующее
От: PG Bug reporting form
Дата:
Сообщение: BUG #15802: Comparison of a function returning boolean value using relational (<, >, <= or >=) operator