From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | Matthew Wakeling <matthew(at)flymine(dot)org> |
Cc: | Eliot Gable <egable+pgsql-performance(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Highly Efficient Custom Sorting |
Date: | 2010-07-02 14:56:46 |
Message-ID: | AANLkTim90VO9XeZ25XjhbhLjhATVlx6CCQRLDhm24GOL@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Fri, Jul 2, 2010 at 10:50 AM, Matthew Wakeling <matthew(at)flymine(dot)org> wrote:
>> On Fri, Jul 2, 2010 at 12:08 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>>
>>> I'm guessing from tea leaves, but the impression I got from Eliot's
>>> description is that he's using plpgsql functions as sort comparators.
>>> It's not surprising that that sucks performance-wise compared to having
>>> the equivalent logic in C/C++ functions used as comparators on the
>>> client side. plpgsql is no speed demon. Best fix might be to code the
>>> comparators as C functions on the server side.
>
> On Fri, 2 Jul 2010, Eliot Gable wrote:
>>
>> I guess the real question is, is a generic C sorting function my only real
>> alternative?
>
> Sounds to me like you are not really listening. You don't need to code an
> entire sorting algorithm in C, as Postgres already has a pretty good one of
> those. All you need to do is implement a comparator of some kind. Inserting
> C functions into Postgres is pretty easy, especially on the level of
> comparators.
in recent versions of postgres you rarely if ever even have to do that
-- row types are comparable w/o any extra work, as are arrays. If
Eliot would just give a little more deal of WHAT he is trying to sort
and HOW he is currently doing it, i suspect his problem will be
trivially solved :-).
merlin
From | Date | Subject | |
---|---|---|---|
Next Message | Ranga Gopalan | 2010-07-02 15:28:45 | Question about partitioned query behavior |
Previous Message | Matthew Wakeling | 2010-07-02 14:50:55 | Re: Highly Efficient Custom Sorting |