I have a ms sql table with 3 columns: id (pk), sku and quantity.
Once a day this table is truncated, then populated with new data. Every time new data goes in, the auto increment id never starts at 1, it keeps incrementing, starting at the highest + 1 pre-truncated id value.
My question is, will it ever stop incrementing, causing insert of new data to stop?
If the id (pk) is an int, then it will continue incrementing until 2^32 / 2 - 1, which is 2,147,483,647.
If the id is a bigint, then 2^64 / 2 - 1, which is 9,223,372,036,854,775,807.
And if either the int or bigint is unsigned, then you get double those numbers.
(For some perspective, in order to reach that second number, you’d have to accumulate more than 600 million records every year for as long as the universe has existed.)
ok, thanks. yea it’s an int. I’m good for a while, every day the tables gets about 3000 new rows
In that case, it’ll be a couple thousand years before you run out of PKs.
nice feature, but it doesn’t exist in microsoft sql server