What happens when DB engine runs out of numbers to use for primary keys?

前端 未结 10 1722
感情败类
感情败类 2021-01-18 10:59

Since DBs do not reuse numbers of deleted records it is possible to run out of numbers, especially if you pick not really a big integer type for this column.
What would

10条回答
  •  醉酒成梦
    2021-01-18 11:28

    It depends on your database, I believe in MS SqlServer, you simply cannot insert any new rows until you fix the problem. The last time I encountered it, we fixed the problem by reseeding the identity column to 1. That's obviously not a universal fix, but it was ok with our situation.

提交回复
热议问题