From: Dan Nelson
Date: February 6 2006 10:46pm
Subject: Re: AUTOINCREMENT / UNIQUE Behavior [Newbie Question]
List-Archive: http://lists.mysql.com/mysql/194613
Message-Id: <20060206224615.GC78323@dan.emsphone.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
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