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

前端 未结 10 1623
感情败类
感情败类 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:21

    Oracle doesn't support autoincrementing ID columns and standard practice is to use a sequence generator. A sequence generates integers of up to 28 digits, so if you run out of those then ... I guess you have a pretty big table. But behaviour would then be dependent on the configuration of the sequence generator -- either an error or it would cycle back to the start value and you'd get a PK constraint violation on the next insert.

提交回复
热议问题