Results 1 to 2 of 2
Jan 14, 2002, 13:31 #1
What's wrong with using auto_increments?
With reference to this thread I would like to know why I should not use auto_increments.
I am writing my own code for forums and have used auto_increments for ThreadID, MemberID, and so on. Why should I not use auto_increments? What are the other alternatives for creating unique numbers to identify records in a database?
NOTE: Since this topic is new to me, I request you to keep your explanations simple. Thank you.
Jan 14, 2002, 16:01 #2
- Join Date
- Jul 2001
- 0 Post(s)
- 0 Thread(s)
there's nothing wrong w/ using AUTO_INCREMENT when it's necessary. if you have a column that will suffice for the PRIMARY KEY, use it. but, AUTO_INCREMENT is fine if you need it. for your forum example, in the users table, you could use the username as the PRIMARY KEY, since it has to be unique, right? however, i, personally, wouldn't do that for a couple of reasons. first, because numbers take less space and can be compared faster by MySQL. and second, for a forum, wouldn't you be linking each post to the users table with some kind of ID? in that case, you definitely want to use numbers (e.g. AUTO_INCREMENT).
Last edited by DR_LaRRY_PEpPeR; Jan 14, 2002 at 16:05.- Matt ** Ignore old signature for now... **
Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
"Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR