From: | Sergei Agalakov <sergei(dot)agalakov(at)gmail(dot)com> |
---|---|
To: | legrand legrand <legrand_legrand(at)hotmail(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: {PROPOSAL] add session information column to pg_stat_statements |
Date: | 2018-12-02 18:42:20 |
Message-ID: | 752b2825-eaf4-412b-1b8c-97f8da124ef6@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 12/2/2018 2:22 AM, legrand legrand wrote:
> I'm also very interested by collecting "search_path" information for
> statements,
> but this information may not be unique for pg_stat_statements key
> (dbid,userid,queryid) ...
>
> How would this 1-N relation be handled ?
> 1/ just catch initial session_info for each (dbid,userid,queryid),
> 2/ adding a sessid field in pgss key, and a table for distinct
> sessid,session_info values,
> 3/ store session_info in an array,
> 4/ ...
>
According to documentation queryid is an "Internal hash code, computed
from the statement's parse tree"
so I expect it to be different for the same query with different
current_schemas or current_user
outside of the possible hash collisions if the changes current_schemas
or current_user in ant way affect the execution of the query.
Queryid can be different even for the same combination of
pg_stat_statements.query + pg_stat_statements.session_info (objects can
be dropped and recreated etc.)
I would say that option 1 makes the most sense.
When a user or an application changes search_path or session_user he/she
expects that it will affect the execution of at least some queries,
that's why these setting were introduced in the first place.
If you know that you execute the same queries on the different schemas
then you would like to group your statistics by query+current_schemas.
If you know that you change current_user for row level security then you
would like to group your statistics by query+current_user.
But you need to preserve this session_info for every queryid in
pg_stat_statements.
Thank you,
Sergei
From | Date | Subject | |
---|---|---|---|
Next Message | Michail Nikolaev | 2018-12-02 20:01:43 | Re: Synchronous replay take III |
Previous Message | David Fetter | 2018-12-02 17:44:57 | Re: [PATCH] Log CSV by default |