Re: Have nodeSort.c use datum sorts single-value byref types - Mailing list pgsql-hackers

From David Rowley
Subject Re: Have nodeSort.c use datum sorts single-value byref types
Date
Msg-id CAApHDvqQu+HRvb8-wJARJ_UeF3yv3jRXNXaz=EhvrAFhhksfbg@mail.gmail.com
Whole thread Raw
In response to Have nodeSort.c use datum sorts single-value byref types  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: Have nodeSort.c use datum sorts single-value byref types
List pgsql-hackers
On Thu, 29 Sept 2022 at 18:12, David Rowley <dgrowleyml@gmail.com> wrote:
> In the attached patch, I've added a function named
> tuplesort_getdatum_nocopy() which is the same as tuplesort_getdatum()
> only without the datumCopy(). I opted for the new function rather than
> a new parameter in the existing function just to reduce branching and
> additional needless overhead.

Per what was said over on [1], I've adjusted the patch to just add a
'copy' parameter to tuplesort_getdatum() instead of adding the
tuplesort_getdatum_nocopy() function.

I also adjusted some code in heapam_index_validate_scan() to pass
copy=false to tuplesort_getdatum().  The datum in question here is a
TID type, so this really only saves a datumCopy() / pfree on 32-bit
systems. I wasn't too interested in speeding 32-bit systems up with
this, it was more a case of being able to remove the #ifndef
USE_FLOAT8_BYVAL / pfree code.

I think this is a fairly trivial patch, so if nobody objects, I plan
to push it in the next few days.

David

[1] https://www.postgresql.org/message-id/65629.1664460603%40sss.pgh.pa.us

Attachment

pgsql-hackers by date:

Previous
From: Pavel Luzanov
Date:
Subject: Re: replacing role-level NOINHERIT with a grant-level option
Next
From: Richard Guo
Date:
Subject: Re: Reducing duplicativeness of EquivalenceClass-derived clauses