Select like when searching for whole word and optimizing it

Поиск
Список
Период
Сортировка
In my e-shop I'm using the searching based on select like command;
something like
SELECT * FROM kat WHERE name LIKE '%some_text%';
and when searching for the whole word:
SELECT * FROM kat WHERE name LIKE '% some_text %';
For this is necessary to maintain the name column with one space added
before and after the name column value (to match starting and ending
words). It's working but very ugly. 

Maybe there is some better way to search for the whole word? 

And another question, is there some way to optimize the SELECT LIKE
querry? I know that when I send something like "SELECT * FROM kat WHERE
name LIKE 'blabla%';" postgresql uses the index but not when the search
string begins with '%'... My table is quickly growing and now I can feel
the speed of my web is impacted a lot. 

There is a lot of same values in the name field (for ex. 'QUEEN' about
40 times etc.) - I could make a table with unique only name values and
point to them from the main table kat. Will the searching be more
effective then? 

Thanks for any help; I hope it's interesting not only for me :) 
-- 
Michal Samek, Tony distribuce s.r.o.
webmaster@tony.cz  (++420659/321350)
ICQ: 38607210


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

Предыдущее
От: Michael Klemme
Дата:
Сообщение: SQL Problem: ERROR: ExecEvalExpr: unknown expression type 108
Следующее
От: Nuchanard Chiannilkulchai
Дата:
Сообщение: automatic incrementation