I had a table of names, containing 200,000 rows. This has now been updated to include over 11 million rows.

The table is queried using a SOUNDS LIKE 'str' and the result is then passed through levenshtein_ratio() [a custom function that compares string similarity]. This worked quickly with the 200,000 rows, but with 11 million rows it is now taking two seconds.

I believe I can make this work a lot quicker by saving the soundex of each name, indexing that column, and then searching by this. But am concerned that the levenshtein_ratio() will be slow as it is now being few with potentially 2,000-3,000 result.

I am interested to know how database professional would consider approaching this issue. In particular, I am wondering if it might be better to compute the levenshtein_ratio in PHP.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.