* Luke van Blerk > 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?
The best type to use is the one big enough to hold your expected biggest value, but not bigger. If you think 65535 is too small, use the next bigger type, MEDIUMINT UNSIGNED. Don't use INT "just to be sure"... been there, done that... ;) when your table grows big, you will benefit from the fact that you save a byte for every column, making the indexes smaller & faster. -- Roger query --------------------------------------------------------------------- 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