Re: query_id: jumble names of temp tables for better pg_stat_statement UX
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Sami Imseih <samimseih@gmail.com>, Christoph Berg <myon@debian.org>,
Lukas Fittl <lukas@fittl.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
ma lz <ma100@hotmail.com>
Date: 2025-03-25T23:24:20Z
Lists: pgsql-hackers, pgsql-general
Michael Paquier <michael@paquier.xyz> writes:
> [ v6-0001-Add-custom-query-jumble-function-for-RangeTblEntr.patch ]
Couple of minor review comments ...
* In 5ac462e2b, this bit:
# node type
- if (($t =~ /^(\w+)\*$/ or $t =~ /^struct\s+(\w+)\*$/)
+ if ($query_jumble_custom)
+ {
+ # Custom function that applies to one field of a node.
+ print $jff "\tJUMBLE_CUSTOM($n, $f);\n";
+ }
+ elsif (($t =~ /^(\w+)\*$/ or $t =~ /^struct\s+(\w+)\*$/)
fails to honor $query_jumble_ignore as the other if-branches do.
Perhaps it's unlikely that a node would have both query_jumble_custom
and query_jumble_ignore annotations, but still, the script would emit
completely incorrect code if it did. Also, the "# node type" comment
should probably be moved down to within the first "elsif" block.
* In the v6 patch, this doesn't read very smoothly:
+ * Expanded reference names. This uses a custom query jumble function so
+ * as the table name is included in the computation, not its list of
+ * columns.
Perhaps better
+ * Expanded reference names. This uses a custom query jumble function so
+ * that the table name is included in the computation, but not its list of
+ * columns.
* Also, here:
+ considered the same. However, if the alias for a table is different
+ for semantically similar queries, these queries will be considered
+ distinct.
I'd change "semantically similar queries" to "otherwise-similar
queries"; I think writing "semantically" will just confuse people.
Otherwise LGTM.
regards, tom lane
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Use relation name instead of OID in query jumbling for RangeTblEntry
- 787514b30bb7 18.0 landed
-
Fix two issues with custom_query_jumble in gen_node_support.pl
- 27ee6ede6bc9 18.0 landed
-
pg_stat_statements: Add more tests with temp tables and namespaces
- 3430215fe35f 18.0 landed
-
Add support for custom_query_jumble as a node field attribute
- 5ac462e2b7ac 18.0 landed