Re: Does postgresql 9.0.4 use index on PREFIX%SUFFIX queries? - Mailing list pgsql-general

From Marti Raudsepp
Subject Re: Does postgresql 9.0.4 use index on PREFIX%SUFFIX queries?
Date
Msg-id CABRT9RBPP0zo2OHQPupKJ_PoXAkUfHJ__BjOiO7_HZQ8eQCrdQ@mail.gmail.com
Whole thread Raw
In response to Does postgresql 9.0.4 use index on PREFIX%SUFFIX queries?  ("Edson Carlos Ericksson Richter" <richter@simkorp.com.br>)
Responses RES: Does postgresql 9.0.4 use index on PREFIX%SUFFIX queries?
List pgsql-general
Alban, you forgot to reply to the mailing list. Please use the "reply
to all" button in your email client. :)

On Tue, Sep 27, 2011 at 14:21, Alban Hertroys <haramrae@gmail.com> wrote:
> If performance is an issue, I'd suggest coding it as a C function.
>
> A quick google search turned up:
> http://discuss.fogcreek.com/techInterview/default.asp?cmd=show&ixPost=2077
> for possible implementations.
>
> Of course, for Postgres we'd use pmalloc/pfree instead of malloc/free,
> as the result value will be a Datum.

These can't be adapted directly because they don't behave right in
UTF-8 encoding.

However, there's already a C implementation in the "orafce" project,
no point in reinventing the wheel:
http://pgfoundry.org/projects/orafce/

I have created a wiki page for collecting the most useful
implementations. Anyone is welcome to improve:
https://wiki.postgresql.org/wiki/Reverse_string

(I didn't include Pavel Stehule's implementation because that only
works on 9.0, not earlier. I did include another SQL implementation)

Regards,
Marti

pgsql-general by date:

Previous
From: "Edson Carlos Ericksson Richter"
Date:
Subject: RES: Does postgresql 9.0.4 use index on PREFIX%SUFFIX queries?
Next
From: "Edson Carlos Ericksson Richter"
Date:
Subject: RES: Does postgresql 9.0.4 use index on PREFIX%SUFFIX queries?