Thanks! Thats a great help. I didn't know that about the performance advantage. I was using INT but thought SMALLINT might be better cos it uses less space. Much obliged.
----- Original Message ----- From: "Madscientist" <[EMAIL PROTECTED]> To: "'Luke van Blerk'" <[EMAIL PROTECTED]> Sent: Monday, April 08, 2002 7:57 PM Subject: RE: Best field type for ID? > INT is better. > > First, smallint will cause you trouble when it wraps- there will be key > violations if you ever have more than 65K records. > > Second, from a performance perspective, your processor is likely going > to deal with things as INT... If you pick something smaller, it has to > do extra work to deal with the smaller numbers... Not much more work, > but more than not. > > Hope this helps, > _M > > | -----Original Message----- > | From: Luke van Blerk [mailto:[EMAIL PROTECTED]] > | Sent: Monday, April 08, 2002 1:12 PM > | To: [EMAIL PROTECTED] > | Subject: Best field type for ID? > | > | > | Hi everyone, > | > | What is the best field type to use for an ID field which is > | the primary key and auto-increment? > | > | I wanted to use SMALLINT UNSIGNED because its half the bytes > | of INT but was wondering what happens when it reaches 65535, > | does the auto-increment go back to 1 or will it cause an > | error? Should one use INT instead? > | > | Regards > | Luke van Blerk > | > | > | (mysql) > | > | > | --------------------------------------------------------------------- > | Before posting, please check: > | http://www.mysql.com/manual.php (the manual) > | http://lists.mysql.com/ (the list archive) > | > | To request this thread, e-mail <[EMAIL PROTECTED]> > | To unsubscribe, e-mail > | <[EMAIL PROTECTED]> > | Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > | > | > | > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php