List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:February 6 2006 10:46pm
Subject:Re: AUTOINCREMENT / UNIQUE Behavior [Newbie Question]
View as plain text  
In the last episode (Feb 06), David T. Ashley said:
> I remember in MySQL that you can define an integer table field as
> AUTOINCREMENT and UNIQUE (I might have the specific keywords wrong,
> but everyone will know what I mean).
> 
> In the life of a database where there are frequent additions and
> deletions, 2^32 isn't that large of a number.
> 
> When the integer field reaches 2^32-1 or whatever the upper limit is,
> what happens then?  Will it try to reuse available values from
> records that have been deleted?  Or is it always an error?

It will roll over and return a "duplicate key" error on the first
insert of a low-numbered value that still exists.  If you think you're
going to generate more than 2 billion records, use a BIGINT which will
never roll over (well, if you inserted 2 billion records per second, it
would roll over in ~270 years).

-- 
	Dan Nelson
	dnelson@stripped
Thread
AUTOINCREMENT / UNIQUE Behavior [Newbie Question]David T. Ashley6 Feb
  • Re: AUTOINCREMENT / UNIQUE Behavior [Newbie Question]Dan Nelson6 Feb