Re: Index to support LIKE '%suffix' queries - Mailing list pgsql-sql

From Florian Weimer
Subject Re: Index to support LIKE '%suffix' queries
Date
Msg-id 874q2ik4xf.fsf@mid.deneb.enyo.de
Whole thread Raw
In response to Re: Index to support LIKE '%suffix' queries  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: Index to support LIKE '%suffix' queries
List pgsql-sql
* Alvaro Herrera:

>> > Florian Weimer <fw@deneb.enyo.de> writes:
>> >> Is it possible to create an index to support queries of the form
>> >> "column LIKE '%suffix'" (similar to an ordinary index for LIKE
>> >> 'prefix%', which I also need)?
>
> It is possible to create a functional index on the reverse of the
> string.

Okay.  Is there a predefined reverse function?  I couldn't find one
and I'm wondering if I just missed it.

> Whether or not this beats tsearch2 is something you should investigate ...

It's also possible that for this type of query, sequential scans are
good enough.  I forgot that they are quite fast.


pgsql-sql by date:

Previous
From: "Mauricio Fernandez A."
Date:
Subject: Re: Slow update SQL
Next
From: "A. Kretschmer"
Date:
Subject: Re: Index to support LIKE '%suffix' queries