For a primary key of an integral type, why is it important to avoid gaps?

前端 未结 3 1618
栀梦
栀梦 2021-01-27 17:27

I am generating a surrogate key for a table & due to my hi/lo algorithm, everytime you reboot/restart the machine, gaps may appear.

T1: current hi = 10000000         


        
3条回答
  •  轮回少年
    2021-01-27 18:02

    why is it important that there be no gaps in the sequences

    It is not important. Gaps are fine. For performance reasons, gaps are tolerated.

    What would be useful is a guarantee to have an strictly increasing sequence (i.e. the sequence has the same ordering as the row creation time). But even that is not guaranteed in a clustered configuration (with local counter caches).

提交回复
热议问题