Re: Does postgresql 9.0.4 use index on PREFIX%SUFFIX queries?

Поиск
Список
Период
Сортировка
От Marti Raudsepp
Тема Re: Does postgresql 9.0.4 use index on PREFIX%SUFFIX queries?
Дата
Msg-id CABRT9RAq3WX2FpKPGr2jKxu5XBH37Avf-FtiV9hX6WiyNxm=YQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Does postgresql 9.0.4 use index on PREFIX%SUFFIX queries?  (Harald Fuchs <hari.fuchs@gmail.com>)
Список pgsql-general
On Tue, Sep 27, 2011 at 13:00, Harald Fuchs <hari.fuchs@gmail.com> wrote:
> Pavel Stehule has found a better solution for that:
>
> CREATE OR REPLACE FUNCTION reverse(text) RETURNS text AS $$
>  SELECT string_agg(substring($1 FROM i FOR 1), '')
>  FROM generate_series(length($1), 1, -1) g(i)
> $$ language sql;

I don't want to get into a pissing contest, but I'm not sure by which
criteria this is "better".

When I needed this function, I compared the speed many different
approaches (6 different versions from the mailing lists). The one I
posted above was the winner, a slightly tuned version of the original
by Shoaib Mir. When testing this right now, it takes half the time of
the function you posted, for short non-Unicode strings at least.

Regards,
Marti

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

Предыдущее
От: Harald Fuchs
Дата:
Сообщение: Re: Does postgresql 9.0.4 use index on PREFIX%SUFFIX queries?
Следующее
От: "Edson Carlos Ericksson Richter"
Дата:
Сообщение: RES: Does postgresql 9.0.4 use index on PREFIX%SUFFIX queries?