Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Performance Issues using DELETE

$
0
0
Hi I have a table dbo.CustomerServices with over 10 Million RowsI have none unique Indexes on CustomerID and ServiceIDI've also created a unique Index across both columns.My delete statement is as follows.DELETE FROM dbo.CustomerService WHERE CustomerID =7 and ServiceID =21.This is currently taking 27 seconds to execute, deleting approx. 75,000 rows.The main over head being the index seeks on CustomerID and ServiceID.I can improve performance by performing a soft delete (Updating a bit column(isdeleted)) and then purging the records at a more convenient time. This runs in a second but is not ideal.It would involve changing a lot of code adding predicates to account for the isdeleted=0.Does anyone have any other solutions?

Viewing all articles
Browse latest Browse all 3145

Trending Articles