I've got an index on the first name field of a client table:

create index client_firstname_sndex_idx on client (soundex(first_name));


If I search it with:

select * from client where soundex(first_name) = soundex('Chris');

it is extremely slow. It can take two minutes or more.

But, if I search without a function, like:

select * from client where first_name = 'Chris';

results come back immediately. I have another index:

create index client_firstname_idx on client (first_name);


Even if I don't have an index for something like this:

select * from client where first_name like 'Chr%';

results come back quickly.

Is this a problem with the fuzzy_string_match module in Postgresql? Or indexing on functions in Postgresql? Or am I making some mistake?