Add reset information to pg_stat_statements_info - Mailing list pgsql-hackers

From Seino Yuki
Subject Add reset information to pg_stat_statements_info
Date
Msg-id 29dec17bff5ef40bba20eae641963ca4@oss.nttdata.com
Whole thread Raw
List pgsql-hackers
Hi.

This is a proposal for a new feature in pg_stat_statements extension.
I think we need to add some statistics to pg_stat_statements_info view.

"pg_stat_statements_info.stats_reset" will only be logged if 
"pg_statements_reset()" or "pg_statements_reset(0,0,0)" is executed.
How about changing it to the following ?

[before]
-[ RECORD 1 ]------------------------------
dealloc     | 0
stats_reset | 2021-04-27 21:30:00

[after]
-[ RECORD 1 ]------------------------------------------
dealloc                 | 0
last_reset_all_time     | 2021-04-27 21:30:00
last_reset_userid       | 10
last_reset_userid_time  | 2021-04-27 22:30:00
last_reset_dbid         | 13974
last_reset_dbid_time    | 2021-04-27 23:30:00
last_reset_queryid      | 8436481539005031698
last_reset_queryid_time | 2021-04-27 23:30:00

If "pg_statements_reset(10,0,0)" is executed, then "last_reset_userid", 
"last_reset_userid" are updated, but do not update 
"last_reset_all_time".
If "pg_statements_reset(0,0,0)" is executed, then "last_reset_userid", 
"last_reset_userid" and others are null.

What do you think?

Regards,
Seino Yuki



pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: wal stats questions
Next
From: Ashutosh Bapat
Date:
Subject: Re: Skip temporary table schema name from explain-verbose output.