I am trying to do a comparison between company names using SOUNDEX, but the php call for soundex only outputs 3 digits so the comparisons aren't quite accurate. Is there a way to get a better soundex output so that the results are more accurate?
+1
A:
Depending on what you are SOUNDEXing against, it might be cheaper to do run SOUNDEX() at the database level:
$result = $db->query("
SELECT
company.id,
company.name,
SOUNDEX(company.name) AS soundex
FROM
company
WHERE
company.name SOUNDS LIKE '$companyName'
");
yaauie
2009-01-09 16:05:35
should I create within the mysql database itself what the soundex index is ahead of time?
AFG
2009-01-09 18:27:17
In my opinion, the benefits of doing so (marginal performance increase) do not outweigh the pain/expense (keeping the column in sync). I set up a table with 5000 unique names, indexed name column, and ran SOUNDEX on all. Results: 1.8ms average vs 1.5ms for just retrieving the data without SOUNDEX
yaauie
2009-01-11 23:13:30