Re: Index to support LIKE '%suffix' queries

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Index to support LIKE '%suffix' queries
Дата
Msg-id 20060225181346.GA6092@surnet.cl
обсуждение исходный текст
Ответ на Re: Index to support LIKE '%suffix' queries  (Florian Weimer <fw@deneb.enyo.de>)
Ответы Re: Index to support LIKE '%suffix' queries  (Florian Weimer <fw@deneb.enyo.de>)
Список pgsql-sql
> > 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.  You need to also reverse the patter at query-time as well.
This will make the % be at the end of the pattern, making it an
indexable condition.

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

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


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

Предыдущее
От: Florian Weimer
Дата:
Сообщение: Re: Index to support LIKE '%suffix' queries
Следующее
От: "Yasuhiro Furuse"
Дата:
Сообщение: Re: Relation 0 does not exist