General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Best way to delete records
We have a SQL Server table(table_1) that we occasionally need to perform several
thousand deletes on. This table has several other tables(table_2, table_3, table_4)
with foreign keys defined to the PK in table_1.
Would it be more efficient to enable ON DELETE CASCADE on the
child tables and then in our stored procedure delete table_1 records in batches?
Or would it be better to not enable ON DELETE CASCADE, then in our
stored procedure perform the deletes
on table_2, table_3, table_4 then lastly table_1, and perform the deletes in batches?
We want to avoid blocking and make this as efficient as possible.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only