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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)heroku(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-25 20:36:23
Message-ID: CA+TgmobxT9=NZnZBLEWAh2spErbwpAtjT=eEY9VHOfarvOV92g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Sep 25, 2014 at 3:17 PM, Peter Geoghegan <pg(at)heroku(dot)com> wrote:
>> To find out how much that optimization buys, you
>> should use tuples with many variable-length columns (say, 50)
>> preceding the text column you're sorting on. I won't be surprised if
>> that turns out to be expensive enough to be worth worrying about, but
>> I have not benchmarked it.
>
> Sorry, but I don't follow. I don't think the pertinent question is if
> it's a noticeable cost. I think the pertinent question is if it's
> worth it. Doing something about it necessitates a lot of extra memory
> access. Not doing something about it hardly affects the amount of
> memory access required, perhaps not at all.

I think you're mincing words. If you go back and fix datum1, you'll
spend a bunch of effort doing that. If you don't, you'll pay a cost
on every comparison to re-find the relevant column inside each tuple.
You can compare those costs in a variety of cases, including the one I
mentioned, where the latter cost will be relatively high.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-09-25 20:41:18 Re: END_OF_RECOVERY shutdowns and ResetUnloggedRelations()
Previous Message Stephen Frost 2014-09-25 20:34:06 Re: Review of GetUserId() Usage