In SQL Server an identity column can jump by 10000 if we restart the service. To resolve this problem I disable the IDENTITY CACHE
at SQL Server instance level.
But is there in disadvantage of this?
In SQL Server an identity column can jump by 10000 if we restart the service. To resolve this problem I disable the IDENTITY CACHE
at SQL Server instance level.
But is there in disadvantage of this?
IDENTITY CACHE is a database level scoped configuration. You can disable it using below command.
ALTER DATABASE SCOPED CONFIGURATION SET IDENTITY_CACHE = OFF
It is ON by default. If you disable it, there will be impact to INSERT performance.Reference MSDN article
IDENTITY_CACHE = { ON | OFF }
APPLIES TO: SQL Server (Starting with SQL Server 2017 (14.x)), Azure SQL Database and Azure SQL Managed Instance
Enables or disables identity cache at the database level. The default is ON. Identity caching is used to improve INSERT performance on tables with identity columns. To avoid gaps in the values of an identity column in cases where the server restarts unexpectedly or fails over to a secondary server, disable the IDENTITY_CACHE option. This option is similar to the existing Trace Flag 272, except that it can be set at the database level rather than only at the server level.
Note:
Quoting the documentation
Identity caching is used to improve INSERT performance on tables with identity columns.
So, if you disable the cache you'll be causing a performance penalty. And, as others have said in the comments it doesn't even solve the (perceived) problem you have. Sounds like lose/lose to me.