mardi 30 décembre 2014

Determine whether there is any blocking while deleting large number of records


I would like to know whether there is any way to determine why it is taking too much time say 3 minutes for deleting 50K records from a database hosted in Sql Azure. I have clustered index on primary key and a non-clustered index on ID which is being used in where condition in Delete Query



DECLARE @RowsDeleted INTEGER
SET @RowsDeleted = 1

WHILE (@RowsDeleted > 0)
BEGIN
DELETE top(100) FROM table WHERE ScenarioID= @ID
SET @RowsDeleted = @@ROWCOUNT
END


Is there any way to know whether there are any locks on this table





Aucun commentaire:

Enregistrer un commentaire