Re: Sort functions with specialized comparators
x4mmm@yandex-team.ru
From: "Andrey M. Borodin" <x4mmm@yandex-team.ru>
To: John Naylor <johncnaylorls@gmail.com>
Cc: David Rowley <dgrowleyml@gmail.com>, Антуан Виолин <violin.antuan@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2024-12-05T18:31:53Z
Lists: pgsql-hackers
Attachments
- v4-0001-Use-specialized-sort-facilities.patch (application/octet-stream) patch v4-0001
> On 5 Dec 2024, at 15:16, John Naylor <johncnaylorls@gmail.com> wrote: > > I tried on an older Intel chip and got similar results, so we'll go > with your original comparator: Ack. > I believe src/port/qsort.c was meant to be just for the standard sort > interface as found in a C library. We do have one globally visible > special sort here: > src/backend/utils/sort/qsort_interruptible.c > ...so that directory seems a better fit. OK. BTW do we need ST_CHECK_FOR_INTERRUPTS? > The declaration is in > src/include/port.h, though. Note: that one doesn't have a global > wrapper around a static function -- it's declared global since > ST_SCOPE is not defined. Added static. > > And one more bikeshedding bit that might get noticed: tuplesorts > express their boolean as "reversed". We don't necessarily need to > follow that, but consistency is good for readability. I do not know if "reversed sorting order" is more idiomatic than "ascending sorting order". If you think it is - let's switch argument's name to "reversed". Best regards, Andrey Borodin.
Commits
-
Specialize intarray sorting
- 53d3daa491be 18.0 landed
-
Replace insertion sort in contrib/intarray with qsort().
- 8d1f239003d0 9.5.0 cited