clear markdown compare help donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 462268 distinct fiddles created so far.

CREATE TABLE dbo.JustAnotherTable ( ID INT IDENTITY PRIMARY KEY, notID CHAR(5) NOT NULL ) INSERT dbo.JustAnotherTable WITH (TABLOCKX) SELECT TOP 1000000 'datas' FROM sys.all_objects a1 CROSS JOIN sys.all_objects a2
1000000 rows affected
 hidden batch(es)


ALTER TABLE dbo.JustAnotherTable SET (LOCK_ESCALATION = DISABLE) --maximize the impact of locking
 hidden batch(es)


DECLARE @trash CHAR(5) SELECT @trash = notID FROM dbo.JustAnotherTable SELECT 'Make sure the cache is warm'
(No column name)
Make sure the cache is warm
 hidden batch(es)


DECLARE @trash CHAR(5), @dt DATETIME = SYSDATETIME() SELECT @trash = notID FROM dbo.JustAnotherTable ORDER BY ID OPTION (MAXDOP 1) SELECT DATEDIFF(MILLISECOND,@dt,SYSDATETIME()) AS [Time taken]
Time taken
157
 hidden batch(es)


DECLARE @trash CHAR(5), @dt DATETIME = SYSDATETIME() SELECT @trash = notID FROM dbo.JustAnotherTable (NOLOCK) ORDER BY ID --would be an allocation order scan without this, breaking the comparison OPTION (MAXDOP 1) SELECT DATEDIFF(MILLISECOND,@dt,SYSDATETIME()) AS [Time taken]
Time taken
220
 hidden batch(es)