I have a table that's used to store some temporary bookkeeping stuff. It needs a unique id for each row, so I used an autoincremented column. However, after a while the column reaches it's max value and then I cannot enter new rows into the table. The table is rather small, only ~100 rows at a time since I keep inserting and deleting rows. I would like to somehow make the autoincrement cyclic, e.g after it reaches it's max value it goes back to zero. There's no chance of violating the uniqueness of the column since only the last 100 insertions are present in the table. How can I do that? or is this not the proper solution and there's some better way to get unique tokens for rows in a db?