Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 delete query execution time keeps changing

Author  Topic 

javedwahid
Starting Member

5 Posts

Posted - 2009-12-22 : 16:14:33
Hi,

I have a simple table which I want to delete data from, it has about 19,000,000 records. I run a standard simple delete statement on the table such as:

DELETE TOP(10000)
FROM __TABLE__

Sometimes this query executes in less than a second and sometimes it can take 50 seconds, I don't get that, what would be causing this? Can there be something with the data in the record that takes longer to delete?

The table only has 4 columns, PRIMARY KEY, FOREIGN KEY, SMALLDATETIME, and VARCHAR(255)

Does anyone know why this happens?

Thanks,

Jay

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-22 : 16:20:30
Blocking can be the cause. Check sp_who2 to see what's going on.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -