Hi hackers,

I would like to propose a series of patches that enhance the behavior
of various statistics reset functions by making them return the reset
timestamp. This change improves usability and aligns with the behavior
introduced in commit dc9f8a798[1], where pg_stat_statements_reset()
was updated to return the reset time.

The following functions have been modified to return a TIMESTAMP WITH
TIME ZONE value indicating when the statistics were reset:
- pg_stat_reset()
- pg_stat_reset_shared()
- pg_stat_reset_single_table_counters()
- pg_stat_reset_backend_stats()
- pg_stat_reset_single_function_counters()
- pg_stat_reset_slru()
- pg_stat_reset_replication_slot()
- pg_stat_reset_subscription_stats()
- pg_stat_clear_snapshot()

For pg_stat_reset_backend_stats() and
pg_stat_reset_replication_slot(), the functions return the reset
timestamp when a valid input is provided. If an invalid input is given
(e.g., an invalid backend PID or replication slot name), the functions
return NULL.
This allows users to easily determine whether the reset operation was
successful based on the return value.

Thoughts?

[1] 
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=dc9f8a798307244d791b71f666f50de319799e7c
--
Best regards,
Shinya Kato
NTT OSS Center

Attachment: v1-0001-Make-pg_stat_reset-return-the-reset-time.patch
Description: Binary data

Attachment: v1-0002-Make-pg_stat_reset_shared-return-the-reset-time.patch
Description: Binary data

Attachment: v1-0003-Make-pg_stat_reset_single_table_counters-return-t.patch
Description: Binary data

Attachment: v1-0004-Make-pg_stat_reset_backend_stats-return-the-reset.patch
Description: Binary data

Attachment: v1-0005-Make-pg_stat_reset_single_function_counters-retur.patch
Description: Binary data

Attachment: v1-0006-Make-pg_stat_reset_slru-return-the-reset-time.patch
Description: Binary data

Attachment: v1-0007-Make-pg_stat_reset_replication_slot-return-the-re.patch
Description: Binary data

Attachment: v1-0008-Make-pg_stat_reset_subscription_stats-return-the-.patch
Description: Binary data

Attachment: v1-0009-Make-pg_stat_clear_snapshot-return-the-reset-time.patch
Description: Binary data

Reply via email to