Re: can you have a collumn roll over with auto_increment



Paul DuBois schreef:
mmccaws2 wrote:

can I set an option so that when auto_increment reaches it's maximum
integer value, it will start all over at zero. I'm deleting every 15
minute the earlier entries, so I'm not too worried about the table
growing too large. Can mysql be set to roll once it's max value is
reached?

No.


Right, but there are other ways to deal with this.

1.a. Maybe the type of the auto_increment column isn't UNSIGNED BIGINT
yet.
1.b. If it already is, insert a "page" column that is 0 for all current
records, and set the key to {page, auto_inc_column}, and switch to page
1.

2. If the auto_increment column is not referenced by anything, a
frequent maintenance run to 'floor' the keys could be used.

3. And I suppose you could even disable the auto-increment, and set up
an auto-incrementing trigger that uses a separate table to hold the last
used value, etc.

I think that #3 looks the worst.

--
Affijn, Ruud

"Gewoon is een tijger."

.