Re: Record SET session in VariableSetStmt

From: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Record SET session in VariableSetStmt
Date: 2022-10-06 12:19:32
Message-ID: 2622785c-ec5d-e556-7827-213e32f58da8@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 10/6/22 1:18 PM, Julien Rouhaud wrote:
> Hi,
>
> On Thu, Oct 06, 2022 at 12:57:17PM +0200, Drouvot, Bertrand wrote:
>> Hi hackers,
>>
>> "SET local" is currently recorded in VariableSetStmt (with the boolean
>> is_local) but "SET session" is not.
>>
>> Please find attached a patch proposal to also record "SET session" so that
>> VariableSetStmt records all the cases.
>>
>> Remark: Recording "SET session" will also help for the Jumbling work being
>> done in [1].
>
> I don't think it's necessary. SET and SET SESSION are semantically the same

Thanks for your feedback!

> so
> nothing should rely on how exactly someone spelled it. This is also the case
> for our core jumbling code, where we guarantee (or at least try to) that two
> semantically identical statements will get the same queryid, and therefore
> don't distinguish eg. LIKE vs ~~.

Agree, but on the other hand currently SET and SET SESSION are recorded
with distinct queryid:

postgres=# select calls, query, queryid from pg_stat_statements;
calls | query | queryid
-------+---------------------------------------------+----------------------
2 | select calls, query from pg_stat_statements | -6345508659980235519
1 | set session enable_seqscan=1 | -3921418831612111986
1 | create extension pg_stat_statements | -1739183385080879393
1 | set enable_seqscan=1 | 7925920505912025406
(4 rows)

and this behavior would change with the Jumbling work in progress in [1]
(mentioned up-thread) if we don't record "SET SESSION".

I think that would make sense to keep the same behavior, what do you think?

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-10-06 12:24:15 Re: Move backup-related code to xlogbackup.c/.h
Previous Message Aleksander Alekseev 2022-10-06 12:15:37 Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)