Big MySQL Database - Advice

Soldato
Joined
8 Oct 2005
Posts
4,184
Location
Midlands, UK
Hi,

I have a list of 10,000 mobile phone numbers, stored in the following MySQL table:

ID
Mobile_Number
KEY

As part of a competition page I'm doing, I need to create a unique KEY for each Mobile_Number. As this is a pretty big dataset, is my below logic flawed in any way and if so, what would you recommend?


  • Select * Records from a database
  • Generate a unique key via PHP
  • Check that key doesn't already exist
  • If key is unique, insert this into the database
This would all be done within a loop.

Thanky
 
That uuid() would usually be fine, but the number is a kind of key that needs to be quickly typed in by attendants. Guess I'll have to just genrate this via PHP in my loop, which I imagine will be slower :(
 
Because 10,000 is 5 digits?

Nar, there's some sort of method you use calculate this.

So basically your just trying to make sure that you can't insert duplicate phone numbers? If that is the case then the only way really is to check for that phone number each time you want to insert a new one.

Or are you just trying to get the unique numbers out of the database ( 'select distinct phone_number from database' would achieve that).


All the phone numbers will be unique. I just need to make sure that the KEY is unique for every number.
 
Back
Top Bottom