Is it possible to generate numbers that are 100% unique in a db with millions of records(+ growing)? How?
Asked
Active
Viewed 39 times
-2
-
3INT + AUTO INCREMENT + PRIMARY KEY ? Not sure what database you are using but it should work for most of them. – Maximus2012 Sep 04 '15 at 20:34
-
See if this helps: http://stackoverflow.com/questions/17893988/how-to-make-mysql-table-primary-key-auto-increment-with-some-prefix – Maximus2012 Sep 04 '15 at 20:36
1 Answers
0
You could either make the numbers auto-incrementing so that every number is guaranteed to be unique, or you could create a random number, check to see if it exists, and if it does, create another random number, and then repeat this process until one doesn't exist.

kemp
- 663
- 7
- 23