From: | Bykov Ivan <i(dot)bykov(at)modernsys(dot)ru> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz>, David Rowley <dgrowleyml(at)gmail(dot)com> |
Cc: | 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-10 10:17:45 |
Message-ID: | 58952a9591d2491484741b1208c39170@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello!
>> Variant B is not acceptable IMO as it adds a whole bunch of
>> null-terminators unnecessarily. For example, in a simple "select 1",
>> (expr == NULL) is true 19 times, so that is an extra 19 bytes.
> Variant B is not acceptable here.
Could we improve Variant B?
I was thinking about adding a count of NULL pointers encountered by the query
jumble walker since the last scalar or non-null field visited.
This way, we can traverse the query as follows:
====
QueryA->subNodeOne = &(Value X);
/* JumbleState->Count = 0;
QueryA_ID = hash_any_extended(&(Value X), sizeof(Value X), QueryA_ID) */
QueryA->subNodeTwo = NULL;
/* JumbleState->Count = 1; */
QueryA->subNodeThee = NULL;
/* JumbleState->Count = 2; */
QueryA->subNodeFour = NULL;
/* JumbleState->Count = 3; */
QueryA->scalar = Value Z;
/* QueryA_ID = hash_any_extended(&(JumbleState->Count),
sizeof(JumbleState->Count), QueryA_ID)
JumbleState->Count = 0;
QueryA_ID = hash_any_extended(&(Value Y), sizeof(Value Y), QueryA_ID) */
====
Variant A improvement
---------------------
I have attached the updated Variant A patch with the following changes:
- Implemented a pg_stat_statements regression test (see similar test results
on REL_17_3 in Query-ID-collision-at_pg_stat_statements-1ea6e890b22.txt).
- Added extra description about the Query ID collision
in src/include/nodes/parsenodes.h.
Attachment | Content-Type | Size |
---|---|---|
Query-ID-collision-at_pg_stat_statements-1ea6e890b22.txt | text/plain | 1.3 KB |
v2-0001-Query-ID-Calculation-Fix-Variant-A.patch | application/octet-stream | 5.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2025-03-10 10:56:00 | Re: SQL:2011 application time |
Previous Message | Bertrand Drouvot | 2025-03-10 10:14:07 | Re: Draft for basic NUMA observability |