Re: B-Tree support function number 3 (strxfrm() optimization)

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, Marti Raudsepp <marti(at)juffo(dot)org>, Stephen Frost <sfrost(at)snowman(dot)net>, Greg Stark <stark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thom Brown <thom(at)linux(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: B-Tree support function number 3 (strxfrm() optimization)
Date: 2014-09-03 01:13:16
Message-ID: CAM3SWZSoRvJ+-Bh4B_ux3Hgx4Vsep3YWbMTveCguCJbhcmKHnw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 2, 2014 at 12:22 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> Most places that use a SortSupportData initialize ssup.position
> explicitly, but tuplesort_begin_datum() doesn't. That's an
> inconsistency that should be fixed, but I'm not sure which direction
> is best.

I'm not sure what you mean. tuplesort_begin_datum() only
uses/initializes the Tuplesortstate.onlyKey field, and in fact that
did have its ssup.position initialized to zero in the last revision.
This indicates that we should not apply the optimization, because:

/*
* Conversion to abbreviated representation infeasible in the Datum case.
* It must be possible to subsequently fetch original datum values within
* tuplesort_getdatum(), which would require special-case preservation of
* original values that we prefer to avoid.
*/
state->onlyKey->position = sortKeyOther;

--
Peter Geoghegan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2014-09-03 02:27:11 Re: B-Tree support function number 3 (strxfrm() optimization)
Previous Message Christopher Browne 2014-09-03 00:46:36 Re: PL/pgSQL 2