Re: LIKE search and performance

Поиск
Список
Период
Сортировка
Искать
От
Richard Huxton
Тема
Re: LIKE search and performance
Дата
в 12:52:24
Msg-id
4654632C.4020005@archonet.com
Ответ на
Список
Дерево обсуждения
LIKE search and performance "Andy" <frum@ar-sd.net>
Re: LIKE search and performance Richard Huxton <dev@archonet.com>
Re: LIKE search and performance Rigmor Ukuhe <rigmor.ukuhe@finestmedia.ee>
Re: LIKE search and performance "Andy" <frum@ar-sd.net>
Re: LIKE search and performance Guido Neitzer <lists@event-s.net>
Re: LIKE search and performance "Alexander Staubo" <alex@purefiction.net>
Re: LIKE search and performance James Mansion <james@mansionfamily.plus.com>
Re: LIKE search and performance Magnus Hagander <magnus@hagander.net>
Re: LIKE search and performance James Mansion <james@mansionfamily.plus.com>
Re: LIKE search and performance Mark Lewis <mark.lewis@mir3.com>
Re: LIKE search and performance mark@mark.mielke.cc
Re: LIKE search and performance Richard Huxton <dev@archonet.com>
Re: LIKE search and performance mark@mark.mielke.cc
Re: LIKE search and performance Richard Huxton <dev@archonet.com>
Re: LIKE search and performance mark@mark.mielke.cc
Re: LIKE search and performance "Joshua D. Drake" <jd@commandprompt.com>
Re: LIKE search and performance Richard Huxton <dev@archonet.com>
Re: LIKE search and performance Gregory Stark <stark@enterprisedb.com>
Re: LIKE search and performance Richard Huxton <dev@archonet.com>
Re: LIKE search and performance PFC <lists@peufeu.com>
Re: LIKE search and performance Richard Huxton <dev@archonet.com>
Re: LIKE search and performance PFC <lists@peufeu.com>
Re: LIKE search and performance Richard Huxton <dev@archonet.com>
Re: LIKE search and performance James Mansion <james@mansionfamily.plus.com>
Re: LIKE search and performance mark@mark.mielke.cc
Re: LIKE search and performance Craig James <craig_james@emolecules.com>
Re: LIKE search and performance Alvaro Herrera <alvherre@commandprompt.com>
Re: LIKE search and performance Craig James <craig_james@emolecules.com>
Re: LIKE search and performance PFC <lists@peufeu.com>
Andy wrote:
> SELECT * FROM table
>                              WHERE name like '%john%' or street like '%srt%'
>  
> Anyway, the query planner always does seq scan on the whole table and that
> takes some time. How can this be optimized or made in another way to be
> faster?
>  
> I tried to make indexes on the columns but no success. 

None of the normal indexes will work for finding text in the middle of a 
string. If you do think of a simple way of solving this, drop a short 
letter explaining your idea to your local patent office followed by the 
Nobel prize committee.

However, one of the contrib packages is "tsearch2" which is designed to 
do keyword searches on text for you. It'll also handle stemming (e.g. 
"search" will match "searching" etc.) with the right choice of 
dictionary. Loads of other clever stuff in it too.

It's one of the optional packages with most Linux packaging systems and 
on the Windows one too. If you install from source see the contrib/ 
directory for details.

-- 
   Richard Huxton
   Archonet Ltd
В списке pgsql-performance по дате отправления
От: Vivek Khera
Дата:
От: Vivek Khera
Дата:
FAQ