Re: [HACKERS] qsort again (was Re: Strange Create Index

Поиск
Список
Период
Сортировка
От PFC
Тема Re: [HACKERS] qsort again (was Re: Strange Create Index
Дата
Msg-id op.s42829s9cigqcu@apollo13
обсуждение исходный текст
Ответ на Re: [HACKERS] qsort again (was Re: Strange Create Index  (Mark Lewis <mark.lewis@mir3.com>)
Ответы Re: [HACKERS] qsort again (was Re: Strange Create Index
Re: [HACKERS] qsort again (was Re: Strange Create Index
Список pgsql-performance

> It seems that instead of maintaining a different sorting code path for
> each data type, you could get away with one generic path and one
> (hopefully faster) path if you allowed data types to optionally support
> a 'sortKey' interface by providing a function f which maps inputs to 32-
> bit int outputs, such that the following two properties hold:

    Looks like the decorate-sort-undecorate pattern, which works quite well.
Good idea.
    I would have said a 64 bit int, but it's the same idea. However it won't
work for floats, which is a pity, because floats fit in 64 bits. Unless
more types creep in the code path (which would not necessarily make it
that slower).
    As for text, the worst case is when all strings start with the same 8
letters, but a good case pops up when a few-letter code is used as a key
in a table. Think about a zipcode, for instance. If a merge join needs to
sort on zipcodes, it might as well sort on 64-bits integers...

    By the way, I'd like to declare my zipcode columns as SQL_ASCII while the
rest of my database is in UNICODE, so they are faster to index and sort.
Come on, MySQL does it...

    Keep up !

В списке pgsql-performance по дате отправления:

Предыдущее
От: Greg Stark
Дата:
Сообщение: Re: [HACKERS] qsort again (was Re: Strange Create Index
Следующее
От: Mark Lewis
Дата:
Сообщение: Re: [HACKERS] qsort again (was Re: Strange Create Index