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

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

    In Postgres, the "serial" type is equivalent to the creation of a SEQUENCE with the NO CYCLE option, and setting the default of the field to nextval. Exhausting such a sequence produces an error:

    http://www.postgresql.org/docs/8.3/interactive/sql-createsequence.html

提交回复
热议问题