sql - Efficient database searching for LIKE '%something%' -
i'm trying search through phone numbers phone number containing series of digits.
obviously following going slow:
select * customer phone '%1234%'
i need wildcards, because users allowed enter data in database, might have country codes, leading 1 (as in 1-800) or trailing extension (which separated space.
note: i've created 'cleaned' phone numbers removing non-digit characters, don't have worry dashes, spaces, , like.
is there magic search run in reasonable time?
if you're using mysql, you're looking full text search functionality http://dev.mysql.com/doc/refman/5.1/en/fulltext-search.html
it optimizes queries 1 have listed, , pretty darn fast once set up. you'll need data in mysql, , must in myisam table (not innodb or other.)
i've used in production , works pretty well.
Comments
Post a Comment