Re: A qsort template
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-02-18T06:02:22Z
Lists: pgsql-hackers
Hi, On 2021-02-18 16:09:49 +1300, Thomas Munro wrote: > In another thread[1], I proposed $SUBJECT, but then we found a better > solution to that thread's specific problem. The general idea is still > good though: it's possible to (1) replace several existing copies of > our qsort algorithm with one, and (2) make new specialised versions a > bit more easily than the existing Perl generator allows. So, I'm back > with a rebased stack of patches. I'll leave specific cases for new > worthwhile specialisations for separate proposals; I've heard about > several. One place that could benefit is the qsort that BufferSync() does at the start. I tried your patch for that, and it does reduce the sort time considerably. For 64GB of mostly dirty shared_buffers from ~1.4s to 0.6s. Now, obviously one can argue that that's not going to be the crucial spot, and wouldn't be entirely wrong. OTOH, in my AIO branch I see checkpointer doing ~10GB/s, leading to the sort being a measurable portion of the overall time. Greetings, Andres Freund
Commits
-
Remove debug messages from tuplesort_sort_memtuples()
- 6e647ef0e750 15.0 landed
-
Fix performance regression in tuplesort specializations
- 99c754129d78 15.0 landed
-
Fix tuplesort optimization for CLUSTER-on-expression.
- cc58eecc5d75 15.0 landed
-
Initial pgindent and pgperltidy run for v14.
- def5b065ff22 14.0 cited
-
Specialize checkpointer sort functions.
- 1b88b8908e75 14.0 landed
-
Use sort_template.h for qsort() and qsort_arg().
- f374f4d66425 14.0 landed
-
Use sort_template.h for qsort_tuple() and qsort_ssup().
- 8eda3eba3063 14.0 landed
-
Add sort_template.h for making sort functions.
- 0a1f1d3cac6b 14.0 landed
-
Use abbreviated keys for faster sorting of text datums.
- 4ea51cdfe85c 9.5.0 cited