Re: Insertion Sort Improvements

From: Benjamin Coutu <ben(dot)coutu(at)zeyos(dot)com>
To: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Insertion Sort Improvements
Date: 2022-09-27 09:39:31
Message-ID: 6047084d3cc4d8cf4ef7@zeyos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

This talk is specific to database sorting and illustrates how such an approach can be vectorized: https://youtu.be/HeFwVNHsDzc?list=PLSE8ODhjZXjasmrEd2_Yi1deeE360zv5O&t=1090

It looks like some of the commercial DBMSs do this very successfully. 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?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-09-27 09:41:54 Re: Refactor backup related code (was: Is it correct to say, "invalid data in file \"%s\"", BACKUP_LABEL_FILE in do_pg_backup_stop?)
Previous Message Thomas Munro 2022-09-27 09:30:22 Re: Use pg_pwritev_with_retry() instead of write() in dir_open_for_write() to avoid partial writes?