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:
- identity - simplest, can have gaps when server restarted etc.
- sequence - separate object, have still gaps in case of rollback
- a separate table numbers - won't have gaps, can hotspot can cause blocking.
Comments
Post a Comment