Add reset information to pg_stat_statements_info

From: Seino Yuki <seinoyu(at)oss(dot)nttdata(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Add reset information to pg_stat_statements_info
Date: 2021-04-27 13:13:19
Message-ID: 29dec17bff5ef40bba20eae641963ca4@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2021-04-27 13:29:09 Re: Skip temporary table schema name from explain-verbose output.
Previous Message Fujii Masao 2021-04-27 12:56:20 Re: wal stats questions