Re: Differentiate MERGE queries with different structures

Поиск
Список
Период
Сортировка
От Julien Rouhaud
Тема Re: Differentiate MERGE queries with different structures
Дата
Msg-id 20220926092534.ufxr4f7t7wjqfrdh@jrouhaud
обсуждение исходный текст
Ответ на Differentiate MERGE queries with different structures  (bt22nakamorit <bt22nakamorit@oss.nttdata.com>)
Ответы Re: Differentiate MERGE queries with different structures  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-hackers
Hi,

On Mon, Sep 26, 2022 at 03:12:46PM +0900, bt22nakamorit wrote:
>
> pg_stat_statements module distinguishes queries with different structures,
> but some visibly different MERGE queries were combined as one
> pg_stat_statements entry.
> For example,
> MERGE INTO test1 USING test2 ON test1.id = test2.id WHEN MATCHED THEN UPDATE
> var = 1;
> MERGE INTO test1 USING test2 ON test1.id = test2.id WHEN MATCHED THEN
> DELETE;
> These two queries have different command types after WHEN (UPDATE and
> DELETE), but they were regarded as one entry in pg_stat_statements.
> I think that they should be sampled as distinct queries.

Agreed.

> I attached a patch file that adds information about MERGE queries on the
> documentation of pg_stat_statements, and lines of code that helps with the
> calculation of queryid hash value to differentiate MERGE queries.
> Any kind of feedback is appreciated.

I didn't test the patch (and never looked at MERGE implementation either), but
I'm wondering if MergeAction->matched and MergeAction->override should be
jumbled too?

Also, the patch should contain some extra tests to fully cover MERGE jumbling.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "houzj.fnst@fujitsu.com"
Дата:
Сообщение: RE: A doubt about a newly added errdetail
Следующее
От: Dagfinn Ilmari Mannsåker
Дата:
Сообщение: Re: Add ON CONFLICT DO RETURN clause