Re: Set query_id for query contained in utility statement
От | Anthonin Bonnefoy |
---|---|
Тема | Re: Set query_id for query contained in utility statement |
Дата | |
Msg-id | CAO6_XqqyNK7U-TtJV4hny5qCbCUY_e_4iOgT45fU7ffbwrpzFg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Set query_id for query contained in utility statement (jian he <jian.universality@gmail.com>) |
Список | pgsql-hackers |
On Mon, Sep 30, 2024 at 5:14 PM jian he <jian.universality@gmail.com> wrote: > Is it possible to normalize top level utilities explain query, make > these two have the same queryid? > explain(verbose) EXECUTE test_prepare_pgss1(1, 2); > explain(verbose) EXECUTE test_prepare_pgss1(1, 3); > > I guess this is a corner case. This seems to be a known issue. The test_prepare_pgss1's parameters are A_Const nodes. Those nodes have a custom query jumble which doesn't record location[1] and thus can't be normalised by pgss. That could be fixed by replacing the switch on nodeTag by JUMBLE_LOCATION(location) but this will impact a lot of DDL queries and the result doesn't look great (for example, "BEGIN TRANSACTION NOT DEFERRABLE, READ ONLY, READ WRITE, DEFERRABLE" would be normalised as "BEGIN TRANSACTION $1 DEFERRABLE, $2 ONLY, $3 WRITE, $4") Looking at the commit for the A_Const's jumble, this is mentioned by Michael[2]: > (FWIW, I'd like to think that there is an argument to normalize the > A_Const nodes for a portion of the DDL queries, by ignoring their > values in the query jumbling and mark a location, which would be > really useful for some workloads, but that's a separate discussion I > am keeping for later.) I haven't found any recent discussion but this should live in a different thread as this is a separate issue. [1]: https://github.com/postgres/postgres/blob/cf4401fe6cf56811343edcad29c96086c2c66481/src/backend/nodes/queryjumblefuncs.c#L323-L355 [2]: https://www.postgresql.org/message-id/Y9+HuYslMAP6yyPb@paquier.xyz
В списке pgsql-hackers по дате отправления: