From: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Add stats_reset to pg_stat_all_tables|indexes and related views |
Date: | 2025-10-02 09:53:06 |
Message-ID: | aN5LgmiyrBNFQJHk@ip-10-97-1-34.eu-west-3.compute.internal |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi hackers,
while working on relfilenode statistics [1], I observed that it's possible to call
pg_stat_reset_single_table_counters() on a relation but the reset time is not
reported in the related views.
I think it's interesting to know when the stats have been reset, so the attached
patch is adding stats_reset to the related views.
Also, it's more consistent with other stat kinds that also report reset times.
This new field is not included into the pg_stat_xact_* views because the 0 values
in transaction-local stats have nothing to do with reset operations.
The patch is pretty straightforward, it:
- Adds a reset_timestamp_cb to PGSTAT_KIND_RELATION
- Adds a function to retrieve the stats_reset field (note that this function is
created on top of the existing PG_STAT_GET_RELENTRY_TIMESTAMPTZ macro, so lacking
some flexibility regarding the function name)
- Adds the stats_reset field in the views that are concerned
- Updates the documentation
- Updates some tests
Regards,
[1]: https://postgr.es/m/ZlGYokUIlERemvpB%40ip-10-97-1-34.eu-west-3.compute.internal
--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Add-stats_reset-to-pg_stat_all_tables-indexes-and.patch | text/x-diff | 18.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Gustafsson | 2025-10-02 10:00:07 | Re: [PATCH] Add tests for Bitmapset |
Previous Message | Erik Rijkers | 2025-10-02 09:35:23 | Re: pgsql: Add support for base64url encoding and decoding |