Re: Set query_id for query contained in utility statement

From: Anthonin Bonnefoy <anthonin(dot)bonnefoy(at)datadoghq(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Set query_id for query contained in utility statement
Date: 2024-10-21 08:35:17
Message-ID: CAO6_XqrDzrhZD_L2OZu2FYMcPFPBXY=TE0OZsqXJizBeMko9OA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Fri, Oct 18, 2024 at 8:27 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> Beginning with the beginning of this patch series.
>
> +SELECT toplevel, calls, query FROM pg_stat_statements
> + ORDER BY toplevel desc, query COLLATE "C";
>
> In v8-0001, for the tests that want to track the queries showing up,
> could it be better to adjust the ORDER BY to be (query, toplevel,
> calls), making the query string first? This way, it is possible to
> see which are the doublons of queries showing up for toplevel as true
> and false depending on the utility.

I've updated 0001 to only use ORDER BY query. The query strings are
not exact doublons, as the nested statement has the additional ending
';' due to using the whole string instead of just the RawStmt. Thus,
the other sort expressions will never be used since there's no
equality. There's also the possibility of breaking down each statement
in individual blocks, with pgss reset and fetch for each one. However,
I feel it's gonna add a lot of noise in the test file.

Attachment Content-Type Size
v9-0003-Set-query_id-for-queries-contained-in-utility-sta.patch application/octet-stream 23.0 KB
v9-0002-Track-location-to-extract-relevant-part-in-nested.patch application/octet-stream 42.5 KB
v9-0001-Add-tests-covering-pgss-nested-queries.patch application/octet-stream 55.6 KB
v9-0004-Use-view-s-definition-as-query-string-on-a-materi.patch application/octet-stream 6.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2024-10-21 09:06:29 [PATCH] Add array_reverse() function
Previous Message Tender Wang 2024-10-21 08:30:45 Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails