query_id: jumble names of temp tables for better pg_stat_statement UX
Christoph Berg <myon@debian.org>
From: Christoph Berg <myon@debian.org>
To: Michael Paquier <michael@paquier.xyz>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, ma lz <ma100@hotmail.com>
Date: 2025-03-18T16:51:54Z
Lists: pgsql-hackers, pgsql-general
Attachments
- v2-0001-Jumble-temp-tables-by-name.patch (text/x-diff)
Re: Michael Paquier
> This is OK on its own, still feels a bit incomplete, as the relid also
> includes an assumption about the namespace. I would suggested to add
> a hardcoded "pg_temp" here, to keep track of this assumption, at
> least.
I had thought about it, but figured that integers and strings are
already separate namespaces, so hashing them shouldn't have any
conflicts. But it's more clear to do that, so added in the new
version:
AppendJumble(jstate, (const unsigned char *)"pg_temp", sizeof("pg_temp"));
AppendJumble(jstate, (const unsigned char *)rel_name, strlen(rel_name));
> typedef struct RangeTblEntry
> {
> - pg_node_attr(custom_read_write)
> + pg_node_attr(custom_read_write, custom_query_jumble)
>
> This structure still includes some query_jumble_ignore, which are not
> required once custom_query_jumble is added.
I would tend to keep them for documentation purposes. (The other
custom_query_jumble functions have a much more explicit structure so
there it is clear which fields are supposed to be jumbled.)
> We had better document at the top of RangeTblEntry why we are using a
> custom function.
I added a short comment just above custom_query_jumble.
Christoph
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