Conversation
How about making JITing of the in-memory portion qsort your next task? ;)
1
2
Replying to
I was thinking of adding more qsort specializations to make SortTuple structs smaller in some cases (24 bytes -> 16) anyway. Found this sped up CREATE INDEX CONCURRENTLY TID sort quite nicely. Maybe JITing would be the easiest way to do this.
1
2
Replying to
I think it's worth a try - I suspect it'll often end up being faster and definitely less duplicative, but ...
1
FWIW, not having thought this through, it doesn't sound hard: Create jit context, use it to create wrapper function calling pg_qsort with constant comparator, force inlining to be enabled, use created function. ~30-60 LOC.
1
Replying to
In the case of CIC TID sorts, I actually got it down to 8 bytes per "SortTuple" -- in fact, Tuplesort was sorting raw Datums. 3x memory saving was quite nice.
Replying to
Not bad. But I've to admit I'm a bit more interested in making tuplesorts used in analytics queries faster ;)

