Every 3rd Insert Is Slow On Ms Sql 2008

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-05-18T18:05:22Z Indexed on 2010/05/18 18:40 UTC
Read the original article Hit count: 309

Filed under:
|
|

I have a function that writes 3 lines into a empty table like so:

INSERT [dbo].[yaf_ForumAccess] ([GroupID], [ForumID], [AccessMaskID]) VALUES (1, 8, 1) 
INSERT [dbo].[yaf_ForumAccess] ([GroupID], [ForumID], [AccessMaskID]) VALUES (2, 8, 4)
INSERT [dbo].[yaf_ForumAccess] ([GroupID], [ForumID], [AccessMaskID]) VALUES (3, 8, 3)

For some reason only the third query takes a long time to execute - and with each insert it grows longer.

Profiler Image Profiler Image

I have tried disabling all constraints on the table - same result. I just can't figure out why the first two would run so fast - and the last one would take so long.

Any help would be greatly appreciated.

Here is the statistics for a query ran MSSMS:

Query:

ALTER TABLE [dbo].[yaf_ForumAccess] NOCHECK CONSTRAINT ALL
INSERT [dbo].[yaf_ForumAccess] ([GroupID], [ForumID], [AccessMaskID]) VALUES (1, 9, 1) 
INSERT [dbo].[yaf_ForumAccess] ([GroupID], [ForumID], [AccessMaskID]) VALUES (2, 9, 4)
INSERT [dbo].[yaf_ForumAccess] ([GroupID], [ForumID], [AccessMaskID]) VALUES (3, 9, 3)
ALTER TABLE [dbo].[yaf_ForumAccess] CHECK CONSTRAINT ALL

Stats:

alt text
Stats

© Stack Overflow or respective owner

Related posts about tsql

Related posts about sql-server-2008