Re: Query Jumbling for CALL and SET utility statements

Sami Imseih <simseih@amazon.com>

From: "Imseih (AWS), Sami" <simseih@amazon.com>
To: Fujii Masao <masao.fujii@oss.nttdata.com>, "Drouvot, Bertrand" <bdrouvot@amazon.fr>, Julien Rouhaud <rjuju123@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>, "Schneider (AWS), Jeremy" <schnjere@amazon.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Pavel Stehule <pavel.stehule@gmail.com>, Andres Freund <andres@anarazel.de>
Date: 2022-09-16T15:08:59Z
Lists: pgsql-hackers
>    The utility commands for cursor like DECLARE CURSOR seem to have the same issue
>    and can cause lots of pgss entries. For example, when we use postgres_fdw and
>    execute "SELECT * FROM <foreign table> WHERE id = 10" five times in the same
>    transaction, the following commands are executed in the remote PostgreSQL server
>    and recorded as pgss entries there.

>    DECLARE c1 CURSOR FOR ...
>    DECLARE c2 CURSOR FOR ...
>    DECLARE c3 CURSOR FOR ...

+1

I also made this observation recently and have a patch to suggest
to improve tis situation. I will start a separate thread for this.

Regards,

--
Sami Imseih
Amazon Web Services (AWS)


Commits

  1. Show values of SET statements as constants in pg_stat_statements

  2. Teach contrib/pg_stat_statements to handle multi-statement commands better.