3 ms·
> For one, if your IDs are approaching the 2^31 signed integer limit, then by definition, you have nearly two billion rows Just wanted to nitpick this; this is
by lcnPylGDnU4H9OF 1y ago
> For one, if your IDs are approaching the 2^31 signed integer limit, then by definition, you have nearly two billion rows
Just wanted to nitpick this; this is not actually definitively true. A failed insert in some systems will increment the counter and deleting rows usually does not allow the deleted ID to be re-used (new inserts use the current counter). Of course, that is beside the point: the typical case of a table approaching this limit is a very large table.
- lmm 1y agoIt's actually fairly common to see this problem crop up in systems that are using a database table as a queue (which is a bad idea for many reasons, but people still do it) in which case the number of live rows in the table can be fairly small.
- jamwil 1y agoIf a SQLServer instance is killed unceremoniously it adds 1000 to the pk increment.
- jiggawatts 1y agoI'm trying not to imagine the poor SQL Server that has crashed one or two million times and hence pushed the ID values into the billions!
- jamwil 1y agohaha—somewhere out there it’s crashing right now. Keep it in your thoughts.