Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements

Andrei Zubkov <zubkov@moonset.ru>

From: Andrei Zubkov <zubkov@moonset.ru>
To: "Anton A. Melnikov" <aamelnikov@inbox.ru>, pgsql-hackers@lists.postgresql.org
Date: 2021-12-03T16:55:53Z
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 →
  1. Improve quoting in some error messages

On Fri, 2021-12-03 at 17:03 +0300, Andrei Zubkov wrote:
> I've added the following fields to the pg_stat_statements view:
> 
>     min_plan_time_local float8,
>     max_plan_time_local float8,
>     min_exec_time_local float8,
>     max_exec_time_local float8
> 
> and a function that is able to reset those fields:
> 
> CREATE FUNCTION pg_stat_statements_reset_local(IN userid Oid DEFAULT
> 0,
>         IN dbid Oid DEFAULT 0,
>         IN queryid bigint DEFAULT 0
> )
> 
> It resets the local fields mentioned above and updates the new field
> 
>     local_stats_since timestamp with time zone
> 
> with the current timestamp. All other statement statistics are
> remains
> unchanged. 

After adding new fields to pg_stat_statements view it looks a little
bit overloaded. Furthermore, fields in this view have different
behavior.

What if we'll create a new view for such resettable fields? It will
make description of views and reset functions in the docs much more
clear.
-- 
Andrei Zubkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company