| From: | John Naylor <johncnaylorls(at)gmail(dot)com> |
|---|---|
| To: | zengman <zengman(at)halodbtech(dot)com> |
| Cc: | pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: tuple radix sort |
| Date: | 2026-02-10 13:37:59 |
| Message-ID: | CANWCAZYBgHCpS-w5E8+wJpfhwLK88Kys-5ukSta2gj4BRPiTSg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Wed, Jan 21, 2026 at 1:40 PM John Naylor <johncnaylorls(at)gmail(dot)com> wrote:
> Attached is v6, which seems pretty close to committable. The temporary
> GUC is gone, as are all the integer-like qsort specializations. There
> are a few cosmetic rearrangements, but the algorithm is pretty much
> the same as v5. The only visible behavior difference should be the
> addition of a presorted check just like qsort has.
I did some more self-review after a couple weeks and made some more
minor cosmetic adjustments for v7. I will commit 0001 and 0002 in a
few days unless there are objections.
> * The only things I have doubts about are the user-visible messages
> mentioning "qsort". For trace_sort, it seemed logical to re-use the
> term "internal sort" from other such messages, so I've done that for
> v6. EXPLAIN ANALYZE is a bit harder: Do we want to even change
> anything here? When things like this come up, there is the question of
> tools that parse the output. It doesn't seem particularly important to
> try to display exact info here, especially since radix sort must
> divert to qsort for multiple keys etc.
I decided to split this out to a separate patch, 0003. It doesn't seem
important, and may not be desirable after all. There is also a 0004
which is just verifying sort order in assert builds on the existing
qsort calls and not just the new sort. Looks better this way.
> Speaking of the NULL partitioning step, I've tried to add some
> comments that make sense, but the pictures in the linked blog are more
> helpful than any words I can come up with. It's easier to understand
> than to describe.
I tried to improve readability here and added missing CHECK_FOR_INTERRUPTS().
Also ran UB sanitizer and Valgrind.
On Wed, Jan 21, 2026 at 3:12 PM zengman <zengman(at)halodbtech(dot)com> wrote:
> I wanted to point out a small detail: the line `extern PGDLLIMPORT bool wip_radix_sort;`
> in v6-0001 appears to not have been fully cleaned up — I suspect it might have been overlooked.
Fixed as well.
--
John Naylor
Amazon Web Services
| Attachment | Content-Type | Size |
|---|---|---|
| v7-0002-Detect-common-prefix-to-avoid-wasted-work-during-.patch | text/x-patch | 3.0 KB |
| v7-0001-Perform-radix-sort-on-SortTuples-with-pass-by-val.patch | text/x-patch | 28.5 KB |
| v7-0004-WIP-Call-verify_memtuples_sorted-after-qsort-for-.patch | text/x-patch | 1.5 KB |
| v7-0003-WIP-Add-possible-message-changes.patch | text/x-patch | 1.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bertrand Drouvot | 2026-02-10 13:38:15 | Re: Report bytes and transactions actually sent downtream |
| Previous Message | Alexander Pyhalov | 2026-02-10 13:31:12 | Re: Limit memory usage by postgres_fdw batches |