pg_stat_database update stats_reset only by pg_stat_reset

From: 张连壮 <lianzhuangzhang(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_stat_database update stats_reset only by pg_stat_reset
Date: 2019-05-13 07:30:54
Message-ID: CALerpYrJbDZ258WxYkZPrYpLDom==25NHVSpXkkPW0MML2-wtA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

sample:
drop database if exists lzzhang_db;
create database lzzhang_db;
\c lzzhang_db

create table lzzhang_tab(id int);
insert into lzzhang_tab values(1);
insert into lzzhang_tab values(1);

select tup_fetched, stats_reset from pg_stat_database where
datname='lzzhang_db';
select pg_sleep(1);

select pg_stat_reset_single_table_counters('lzzhang_tab'::regclass::oid);
select tup_fetched, stats_reset from pg_stat_database where
datname='lzzhang_db';

result:
tup_fetched | stats_reset
-------------+-------------------------------
514 | 2019-05-12 03:22:55.702753+08
(1 row)
tup_fetched | stats_reset
-------------+-------------------------------
710 | 2019-05-12 03:22:56.729336+08
(1 row)
tup_fetched is not reset but stats_reset is reset.

Attachment Content-Type Size
0001-pg_stat_database-update-stats_reset-only-by-pg_stat_.patch text/x-patch 1.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2019-05-13 07:42:56 Re: SQL-spec incompatibilities in similar_escape() and related stuff
Previous Message Michael Paquier 2019-05-13 07:14:27 Re: pglz performance