Re: Insertion Sort Improvements - Mailing list pgsql-hackers

From John Naylor
Subject Re: Insertion Sort Improvements
Date
Msg-id CAFBsxsFs5=0yHx+-03EYkf+Y_s0evkgDYstUXFeQvogTi7dSig@mail.gmail.com
Whole thread Raw
In response to Re: Insertion Sort Improvements  (Benjamin Coutu <ben.coutu@zeyos.com>)
Responses Re: Insertion Sort Improvements
Re: Insertion Sort Improvements
List pgsql-hackers

On Tue, Sep 27, 2022 at 4:39 PM Benjamin Coutu <ben.coutu@zeyos.com> wrote:
>
> Getting back to improvements for small sort runs, it might make sense to consider using in-register based sorting via sorting networks for very small runs.

> It looks like some of the commercial DBMSs do this very successfully. 

"Looks like"?

> They use 4 512bit registers (AVX-512) in this example, which could technically store 4 * 4 sort-elements (given that the sorting key is 64 bit and the tuple pointer is 64 bit). I wonder whether this could also be done with just SSE (instead of AVX), which the project now readily supports thanks to your recent efforts?

SortTuples are currently 24 bytes, and supported vector registers are 16 bytes, so not sure how you think that would work.

More broadly, the more invasive a change is, the more risk is involved, and the more effort to test and evaluate. If you're serious about trying to improve insertion sort performance, the simple idea we discussed at the start of the thread is a much more modest step that has a good chance of justifying the time put into it. That is not to say it's easy, however, because testing is a non-trivial amount of work.

--
John Naylor
EDB: http://www.enterprisedb.com

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: A doubt about a newly added errdetail
Next
From: Masahiko Sawada
Date:
Subject: Re: [PoC] Improve dead tuple storage for lazy vacuum