Re: Considering additional sort specialisation functions for PG16 - Mailing list pgsql-hackers

From John Naylor
Subject Re: Considering additional sort specialisation functions for PG16
Date
Msg-id CAFBsxsFk8dv0EPQ3zxcONNTxbhpe4SWG+n-PTeUJSQvC76LW=g@mail.gmail.com
Whole thread Raw
In response to Re: Considering additional sort specialisation functions for PG16  (John Naylor <john.naylor@enterprisedb.com>)
List pgsql-hackers

I wrote:
> Have two memtuple arrays, one for first sortkey null and one for first sortkey non-null:

Hacking on this has gotten only as far as the "compiles but segfaults" stage, but I wanted to note an idea that occurred to me:

Internal qsort doesn't need the srctape member, and removing both that and isnull1 would allow 16-byte "init-tuples" for qsort, which would save a bit of work_mem space, binary space for qsort specializations, and work done during swaps.

During heap sort, we already copy one entry into a stack variable to keep from clobbering it, so it's not a big step to read a member from the init array and form a regular sorttuple from it.

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

pgsql-hackers by date:

Previous
From: gkokolatos@pm.me
Date:
Subject: RE: Add LZ4 compression in pg_dump
Next
From: Jelte Fennema
Date:
Subject: Re: proposal: psql: psql variable BACKEND_PID