Re: Normalization of utility queries in pg_stat_statements

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: jian he <jian(dot)universality(at)gmail(dot)com>
Cc: "Drouvot, Bertrand" <bertranddrouvot(dot)pg(at)gmail(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Normalization of utility queries in pg_stat_statements
Date: 2023-08-17 23:31:37
Message-ID: ZN6t2cfi21+YFoet@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 16, 2023 at 05:11:47PM +0800, jian he wrote:
> SELECT calls, toplevel, rows, query FROM pg_stat_statements ORDER BY
> query COLLATE "C";
> returns:
> calls | toplevel | rows | query
> -------+----------+------+------------------------------------
> 1 | t | 0 | CALL ptest3($1)
> 2 | f | 2 | INSERT INTO cp_test VALUES ($2, x)
> 1 | t | 1 | SELECT pg_stat_statements_reset()
>
> here, the intermediate CALL part is optimized away. or should I expect
> CALL ptest1($1) also in pg_stat_statements?

I would have guessed that ptest1() being called as part of ptest3()
should show up in the report if you use track = all, as all the nested
queries of a function, even if it is pure SQL, ought to show up. Now
note that ptest1() not showing up is not a new behavior, ~15 does the
same thing by missing it.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-08-17 23:49:16 Re: Logging of matching pg_hba.conf entry during auth skips trust auth, potential security issue
Previous Message Jeff Davis 2023-08-17 23:29:56 Re: Use of additional index columns in rows filtering