I'm trying to search through phone numbers for any phone number containing some series of digits.
Obviously the following is going to be slow:
Select * from customer where phone like '%1234%'
I need the wildcards, because the users were allowed to enter any data in the database, so it might have country codes, a leading 1 (as in 1-800) or a trailing extension (which was sometimes just separated by a space.
Note: I've already created 'cleaned' phone numbers by removing all non-digit characters, so I don't have to worry about dashes, spaces, and the like.
Is there any magic to get a search like this to run in reasonable time?