Re: Query ID Calculation Fix for DISTINCT / ORDER BY and LIMIT / OFFSET
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Sami Imseih <samimseih@gmail.com>, Ivan Bykov <I.Bykov@modernsys.ru>, pgsql-hackers@postgresql.org
Date: 2025-03-21T05:45:09Z
Lists: pgsql-hackers
Attachments
- 0001-Add-more-entropy-to-query-jumbling.patch (text/x-diff) patch 0001
- 0002-Trick-to-measure-jumbling.patch.txt (text/plain)
On Tue, Mar 18, 2025 at 09:24:06PM +1300, David Rowley wrote: > If it's for Assert enabled builds only, then to save from having to > look at the buffer, you could have an extra field similar to > jumble_len, but does not get reset when the jumble buffer fills. Just > assert that the total_jumbled_bytes has grown after jumbling a node, > maybe? Indeed, this would work as well, and there's little point in going full-memcmp() mode for the sake of such a check. I have been doing some measurements to see how the NULL addition affects the computation, and with the attached (based on what you have sent upthread), I can see that a "SELECT 1", which would be one of the worst cases possible based on its simple Query structure with 19 NULLs and not much else (?), jumps from 80ms to 107~109ms for 100k loops calling JumbleQuery(), meaning that a single computation moves from 800ns to 1070~1090ns on my local machine. So this stuff costs, which is not surprising, but it does not seem *that* bad compared to a full query run. Potential ideas about optimizing the branches seem worth investigating, I am not sure that I would be able to dig into that until the feature freeze gong, unfortunately, and it would be nice to fix this issue for this release. I'll see about doing some pgbench runs on my side, as well, with tpc-b Querys. Thoughts? -- Michael
Commits
-
Optimize Query jumble
- ad9a23bc4f51 18.0 landed