Re: Highly Efficient Custom Sorting

От: Matthew Wakeling
Тема: Re: Highly Efficient Custom Sorting
Дата: ,
Msg-id: alpine.DEB.2.00.1007021548080.2534@aragorn.flymine.org
(см: обсуждение, исходный текст)
Ответ на: Re: Highly Efficient Custom Sorting  (Eliot Gable)
Ответы: Re: Highly Efficient Custom Sorting  (Merlin Moncure)
Список: pgsql-performance

Скрыть дерево обсуждения

Highly Efficient Custom Sorting  (Eliot Gable, )
 Re: Highly Efficient Custom Sorting  (Craig Ringer, )
  Re: Highly Efficient Custom Sorting  (Tom Lane, )
   Re: Highly Efficient Custom Sorting  (Eliot Gable, )
    Re: Highly Efficient Custom Sorting  (Matthew Wakeling, )
     Re: Highly Efficient Custom Sorting  (Merlin Moncure, )
    Re: Highly Efficient Custom Sorting  (Craig James, )
     Re: Highly Efficient Custom Sorting  (Craig Ringer, )
      Re: Highly Efficient Custom Sorting  (Eliot Gable, )
       Re: Highly Efficient Custom Sorting  (Merlin Moncure, )
        Re: Highly Efficient Custom Sorting  (Eliot Gable, )
         Re: Highly Efficient Custom Sorting  (Merlin Moncure, )
          Re: Highly Efficient Custom Sorting  (Alvaro Herrera, )
         Re: Highly Efficient Custom Sorting  (Robert Haas, )
          Re: Highly Efficient Custom Sorting  (Eliot Gable, )
           Re: Highly Efficient Custom Sorting  (Joe Conway, )
            Re: Highly Efficient Custom Sorting  (Eliot Gable, )
             Re: Highly Efficient Custom Sorting  (Eliot Gable, )
              Re: Highly Efficient Custom Sorting  (Tom Lane, )
               Re: Highly Efficient Custom Sorting  (Eliot Gable, )
                Re: Highly Efficient Custom Sorting  (Kenneth Marshall, )
 Re: Highly Efficient Custom Sorting  (Merlin Moncure, )

> On Fri, Jul 2, 2010 at 12:08 AM, Tom Lane <> 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.

Matthew

--
 For those of you who are into writing programs that are as obscure and
 complicated as possible, there are opportunities for... real fun here
                                        -- Computer Science Lecturer


В списке pgsql-performance по дате сообщения:

От: Rajesh Kumar Mallah
Дата:
Сообщение: Re: Extremely high CPU usage when building tables
От: Bruce Momjian
Дата:
Сообщение: Re: No hash join across partitioned tables?