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 2000 Forums
 Transact-SQL (2000)
 Why truncate is much slower than delete??

Author  Topic 

lcpx
Yak Posting Veteran

54 Posts

Posted - 2005-10-25 : 10:43:10
I had a strange question. People always say that the truncate SQL should be much more efficient compare to Delete in terms of running time, I agree with it in the most of cases. But today when I ran a truncate SQL towards one table, not very large one, only 2500 rows. But it's been running for about 2 hours, still no response, I tried many times, but always the same. It took me 1 second to run the delete. (So now the table should be empty)

Then I tried to use DROP table, I got the same result, more than 1 hour, no response.

can anybody kindly explain why. If I do want to drop the table, what should I do?

Appreciate any thought you have on it!

Kristen
Test

22859 Posts

Posted - 2005-10-25 : 11:02:51
I'm guessing, but are there a lot of uncommitted transactions?

Kristen
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-10-25 : 11:13:33
It is probably locked by another process,
run exec sp_who2 and see if there are any blocked processes.

rockmoose
Go to Top of Page

lcpx
Yak Posting Veteran

54 Posts

Posted - 2005-10-25 : 14:50:18
Yes you are right, after kill another process, everything works fine.

Thanks very much!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-26 : 01:30:16
Read this
http://www.sql-server-performance.com/q&a118.asp

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -