Re: Query ID Calculation Fix for DISTINCT / ORDER BY and LIMIT / OFFSET

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Bykov Ivan <i(dot)bykov(at)modernsys(dot)ru>, Sami Imseih <samimseih(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Query ID Calculation Fix for DISTINCT / ORDER BY and LIMIT / OFFSET
Date: 2025-03-26 01:04:13
Message-ID: Z-NSjcQmQjFiC5mc@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 26, 2025 at 11:56:50AM +1300, David Rowley wrote:
> Here is the v8 version with the bug fix and performance stuff
> separated out.

Why not. I assume that you would merge these together?

> I also added the Assert code to ensure we always add
> something to the jumble buffer when jumbling a node.

Thanks. This part looks good with its USE_ASSERT_CHECKING.

> I didn't include the regression tests I saw in the v2b patch [1]. I
> felt these were just marking the fact that there used to be a bug
> here.

I disagree about the lack of tests. These are cheap to add. I'd
suggest to not use the ones posted as part of v2 variant B as these do
not require the creation of a relation so they can be made cheaper,
and instead use the set I have posted in patch 0001 here which covers
most of the main scenarios from the parser with this nodes in the
Query:
https://www.postgresql.org/message-id/Z9z85Ui5lPkPn2hq@paquier.xyz

It is a bit disappointing that we require JumbleQuery() to jumble the
NULLs. There are discussions about making this code available not
only for Querys, but for Nodes, and the NUL computations would be
missed..
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2025-03-26 01:41:25 Re: Statistics Import and Export
Previous Message Sami Imseih 2025-03-26 00:56:29 Re: query_id: jumble names of temp tables for better pg_stat_statement UX