Re: Have nodeSort.c use datum sorts single-value byref types

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Have nodeSort.c use datum sorts single-value byref types
Date: 2022-10-26 10:35:37
Message-ID: CAApHDvqQu+HRvb8-wJARJ_UeF3yv3jRXNXaz=EhvrAFhhksfbg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 29 Sept 2022 at 18:12, David Rowley <dgrowleyml(at)gmail(dot)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 Content-Type Size
v2_allow_datumsorts_for_byref_types.patch text/plain 9.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Guo 2022-10-26 11:04:56 Re: Reducing duplicativeness of EquivalenceClass-derived clauses
Previous Message Pavel Luzanov 2022-10-26 09:51:50 Re: replacing role-level NOINHERIT with a grant-level option