Monday 18 June 2018

Testing sql for concurrency bugs

There is a method for checking SQL or Stored Procedures against concurrency bugs. Using the SQL Server scheduler you can run two queries in parallel.

To do this:
Open two SQL Server query windows and then split them vertically.
Then in each window, run:

waitfor time '13:16:20.00'
exec uspMyStoredProcedure

You might need to run it several times as the scheduler is not accurate to microseconds, but if you have a long-running query it should show the bug relatively quickly.

No comments:

Post a Comment