best way to manage indexes
От | Jamie Kahgee |
---|---|
Тема | best way to manage indexes |
Дата | |
Msg-id | da6bca20912231410g731b3555h53703eacc2e15588@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: best way to manage indexes
Re: best way to manage indexes |
Список | pgsql-general |
what would be considered "best practice" for my situation?
I have a table member, with column name that I want to put an index on, because it is searched quiet frequently. When I create my sql search string, the name will consist only of alpha-numeric characters and be compared against lowercase matches.
SELECT *
FROM member
WHERE lower(regexp_replace(member_name, '[^[:alnum:]]', '', 'g')) ~* 'search_string'
OR lower(metaphone(name, 4)) = lower(metaphone('search_string', 4));
is it better to create an index that matches my search?
create index member_name_idx on member (lower(regexp_replace(name, '[^[:alnum:]]', '', 'g')));
What if we decide we want to allow more characters in the search later - just have to remember to update the index?
do I need two indexes? one for both search parameters (regexp & metaphone)?
perhaps there is a solution that I haven't thought of. any input would be appreciated!
Thanks,
Jamie K.
Jamie K.
В списке pgsql-general по дате отправления: