pg_stat_reset_slru(name) doesn't seem to work as documented

From: Atsushi Torikoshi <atorik(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_stat_reset_slru(name) doesn't seem to work as documented
Date: 2020-05-01 10:10:23
Message-ID: CACZ0uYFe16pjZxQYaTn53mspyM7dgMPYL3DJLjjPw69GMCC2Ow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

When I tried to reset a counter in pg_stat_slru using
pg_stat_reset_slru(name),
not only the specified counter but all the counters were reset.

postgres=# SELECT * FROM pg_stat_slru ;
name | blks_zeroed | blks_hit | blks_read | blks_written |
blks_exists | flushes | truncates | stats_reset

------------------+-------------+----------+-----------+--------------+-------------+---------+-----------+-------------------------------
async | 3 | 0 | 0 | 3 |
0 | 0 | 0 | 2020-05-01 17:36:26.073433+09
clog | 0 | 56 | 0 | 0 |
0 | 0 | 0 | 2020-05-01 17:36:26.073433+09
commit_timestamp | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 2020-05-01 17:36:26.073433+09
(snip)

postgres=# SELECT pg_stat_reset_slru('clog');

postgres=# SELECT * FROM pg_stat_slru ;
name | blks_zeroed | blks_hit | blks_read | blks_written |
blks_exists | flushes | truncates | stats_reset

------------------+-------------+----------+-----------+--------------+-------------+---------+-----------+-------------------------------
async | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 2000-01-01 09:00:00+09
clog | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 2020-05-01 17:37:02.525006+09
commit_timestamp | 0 | 0 | 0 | 0 |
0 | 0 | 0 | 2000-01-01 09:00:00+09
(snip)

Attached a patch.

Regards,

--
Atsushi Torikoshi
NTT DATA CORPORATION

Attachment Content-Type Size
fix_param_specified_pg_stat_reset_slru_v1.patch application/x-patch 497 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jose Luis Tallon 2020-05-01 10:22:39 Re: Raw device on PostgreSQL
Previous Message Victor Wagner 2020-05-01 09:48:17 Re: Postgres Windows build system doesn't work with python installed in Program Files