Here’s some code to create a large number of ghost records.
--rcsi_testing.sql -- create and populate a test table CREATE TABLE dbo.demo_table ( ID INT NOT NULL IDENTITY (1, 1), C1 CHAR(100) NOT NULL ); GO INSERT INTO dbo.demo_table (C1) SELECT TOP (1000) CAST(TEXT AS CHAR(100)) AS C1 FROM sys.messages WHERE language_id = 1031; GO CREATE UNIQUE CLUSTERED INDEX cuix_demo_table_Id ON dbo.demo_table (Id); GO -- start a 1 minute workload SET NOCOUNT ON; GO BEGIN TRANSACTION; ---------**********KEY GO -- Insert new record into dbo.demo_table DECLARE @finish_date DATETIME2(0) = DATEADD(MINUTE, 1, GETDATE()); WHILE @finish_date >= GETDATE() BEGIN -- wait 10 ms before each new process INSERT INTO dbo.demo_table(C1) SELECT C1 FROM dbo.demo_table WHERE Id = (SELECT MIN(Id) FROM dbo.demo_table); -- Wait 10 ms to delete the first record from the table WAITFOR DELAY '00:00:00:010'; -- Now select the min record from the table DELETE dbo.demo_table WHERE Id = (SELECT MIN(Id) FROM dbo.demo_table); END ROLLBACK TRAN; GO