Tag Info

New answers tagged


I finally worked around the problem using SQL Server 2012 sequences. Unfortunately, this won't work with versions prior to 2012. Speed was o.k, one or two minutes for about 20 million IDs to insert. declare @old_max_id int -- get somehow declare @sql nvarchar(2000) set @sql=N'CREATE SEQUENCE INSERT_IDS START WITH ' + str(@old_max_id + 1) + N' INCREMENT BY ...


I have had great success with overall perfomance gains by moving the clustered index to an identity, and leaving the GUID as the PK. If you have a GUID as a clustered PK, you are telling SQL to physically sort the data randomly, leading to page splits and fragmentation in the main table as well as in the non-clustered indexes. By getting your database on ...

Top 50 recent answers are included