List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:November 23 2001 8:45pm
Subject:Re: maxing out an AUTO_INCREMENT field ...
View as plain text  
At 2:42 PM -0600 11/23/01, Camilo Rostoker wrote:
>Hi.
>
>Lets say I have a simple table like this:
>
>CREATE TABLE User ( UserID INT(3) PRIMARY KEY NOT NULL AUTO_INCREMENT,
>Name VARCHAR(64) );
>
>If users are constantly being added to and deleted, this causes major
>gaps in the UserID field.  Eventually,
>there will be 1000 users added, and so the UserID value will be too
>large.  What happens then?  Is there a way to remake the table and
>reassign UserID's starting from 1 ???

You're thinking that INT(3) means that the largest value the column
can contain.  3 is the display width, used for displaying values.
It doesn't constrain the range of the INT column type, which is much
larger than 999.

But one thing you could do is make your column UNSIGNED.  You'll never
use negative numbers in the column, and making it unsigned doubles the
number of sequence numbers you can store in it.

>
>Thanks,
>Camilo Rostoker

Thread
maxing out an AUTO_INCREMENT field ...Camilo Rostoker23 Nov
  • Re: maxing out an AUTO_INCREMENT field ...Paul DuBois23 Nov