Delete rows older than x days without locking table
10
votes
3
answers
25017
views
we have a quite big MS SQL database with millions of rows.
I created a simple script to delete rows older than 1 month, but this seems to lock the table and creates trouble for the application.
The table has an indexed "ID" PK, and also a "date" column which I will use for this task.
What is the best way to do this without causing the lock?
I was considering partitioning, but not sure if its the best way to go.
Thanks in advance.
Asked by DataViking
(101 rep)
Feb 4, 2021, 08:48 AM
Last activity: Jan 16, 2025, 08:42 PM
Last activity: Jan 16, 2025, 08:42 PM