[PATCH] Tracking statements entry timestamp in pg_stat_statements
Andrei Zubkov <zubkov@moonset.ru>
From: Andrei Zubkov <zubkov@moonset.ru>
To: pgsql-hackers@lists.postgresql.org
Date: 2021-03-22T09:07:48Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Improve quoting in some error messages
- 07e5e6674233 14.0 cited
Attachments
- pg_stat_statements_ts_patch_2021_0322.patch (text/x-patch) patch
This is a proposal for a new feature in pg_stat_statements extension. As a statistical extension providing counters pg_stat_statements extension is a target for various sampling solutions. All of them interested in calculation of statement statistics increments between two samples. But we face a problem here - observing one statement with its statistics right now we can't be sure that statistics increment for this statement is continuous from previous sample. This statement could be deallocated after previous sample and come back soon. Also it could happen that statement executions after that increased statistics to above the values we observed in previous sample making it impossible to detect deallocation on statement level. My proposition here is to store statement entry timestamp. In this case any sampling solution in case of returning statement will easily detect it by changed timestamp value. And for every statement we will know exact time interval for its statistics.