Re: Query Jumbling for CALL and SET utility statements - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Query Jumbling for CALL and SET utility statements
Date
Msg-id 9b2133f6-7bf6-07c4-e896-7a8d9a629d56@oss.nttdata.com
Whole thread Raw
In response to Re: Query Jumbling for CALL and SET utility statements  ("Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>)
Responses Re: Query Jumbling for CALL and SET utility statements
List pgsql-hackers

On 2022/09/19 15:29, Drouvot, Bertrand wrote:
> Please find attached v6 taking care of the remarks mentioned above.

Thanks for updating the patch!

+SET pg_stat_statements.track_utility = TRUE;
+
+-- PL/pgSQL procedure and pg_stat_statements.track = all
+-- we drop and recreate the procedures to avoid any caching funnies
+SET pg_stat_statements.track_utility = FALSE;

Could you tell me why track_utility is enabled just before it's disabled?

Could you tell me what actually happens if we don't drop and
recreate the procedures? I'd like to know what "any caching funnies" are.

+SELECT pg_stat_statements_reset();
+CALL MINUS_TWO(3);
+CALL MINUS_TWO(7);
+CALL SUM_TWO(3, 8);
+CALL SUM_TWO(7, 5);
+
+SELECT query, calls, rows FROM pg_stat_statements ORDER BY query COLLATE "C";

This test set for the procedures is executed with the following
four conditions, respectively. Do we really need all of these tests?

track = top, track_utility = true
track = top, track_utility = false
track = all, track_utility = true
track = all, track_utility = false

+begin;
+prepare transaction 'tx1';
+insert into test_tx values (1);
+commit prepared 'tx1';

The test set of 2PC commands is also executed with track_utility = on
and off, respectively. But why do we need to run that test when
track_utility = off?

-    if (query->utilityStmt)
+    if (query->utilityStmt && !jstate)
      {
          if (pgss_track_utility && !PGSS_HANDLED_UTILITY(query->utilityStmt))

"pgss_track_utility" should be
"pgss_track_utility || FORCE_TRACK_UTILITY(parsetree)" theoretically?

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION



pgsql-hackers by date:

Previous
From: Jacob Champion
Date:
Subject: Re: [PoC] Federated Authn/z with OAUTHBEARER
Next
From: João Paulo Labegalini de Carvalho
Date:
Subject: Query JITing with LLVM ORC