I have a table of a ton of data--it's just a single column of a million phone numbers.
I'm working on a PHP script that will receive an uploaded file of numbers, and I'd like to run each number against the database to see if the number already exists. If it does exist, I just need a true returned and no other data.
I have 2 main questions:
- For performance/speed consideration, would it make a difference if
- The column was broken down into two (Column A with Area Code, Column B with remaining digits). That way I could run a query using WHERE to find a matching Area Code for a given number, then match the remaining 7 digits?
- Or would that make no difference than matching the entire 10 digits?
The answer to this question, Best way to test if a row exists in a MySQL table, was:
SELECT EXISTS(SELECT 1 FROM table1 WHERE ...)
If I'm not mistaken, that will simply return the value "1" if what you're searching for exists, correct? Since I'll be receiving the results in PHP, would this be the most efficient way to go?