Search Postgresql Archives

best way to manage indexes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux