tsql - SQL server identity or a self calculated sequence -


i designing database. want define automatic sequence on table primary key field. best solution it?

i know can enable identity property field, has problems ( example seed jumps on restart , unsuccessful events)

i can use calculated sequences. example can calculate max of filed values , after incrementing use key new inserted record.

which 1 better? there solution?

to mind there's 3 options:

  1. identity - simplest, can have gaps when server restarted etc.
  2. sequence - separate object, have still gaps in case of rollback
  3. a separate table numbers - won't have gaps, can hotspot can cause blocking.

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -