From 2bc7799f3c8fb51e7d4071db6034406bcb37c6a6 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 20 Oct 2016 23:04:08 -0400 Subject: [PATCH] delete ciphers in smaller batches. ref #18 --- .../dbo/Stored Procedures/User_DeleteById.sql | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Sql/dbo/Stored Procedures/User_DeleteById.sql b/src/Sql/dbo/Stored Procedures/User_DeleteById.sql index 6dd91e9df..7d8b40df6 100644 --- a/src/Sql/dbo/Stored Procedures/User_DeleteById.sql +++ b/src/Sql/dbo/Stored Procedures/User_DeleteById.sql @@ -6,11 +6,17 @@ BEGIN BEGIN TRANSACTION User_DeleteById - DELETE - FROM - [dbo].[Cipher] - WHERE - [UserId] = @Id + DECLARE @BatchSize INT = 100 + WHILE @BatchSize > 0 + BEGIN + DELETE + FROM + [dbo].[Cipher] + WHERE + [UserId] = @Id + + SET @BatchSize = @@ROWCOUNT + END DELETE FROM