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
 General SQL Server Forums
 New to SQL Server Administration
 Query running long time

Author  Topic 

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2010-07-21 : 05:02:09
Dear All,

One of my delete query taking 5 hours to run in production data warehouse database.

I Checked activity monitor its showing the 200 rows for my proces..

Can you pls somebody help me. ?

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2010-07-21 : 05:34:14
it's hard to help you if you don't post some examples. table definitions. your delete query. etc.
Go to Top of Page

gangadhara.ms
Aged Yak Warrior

549 Posts

Posted - 2010-07-21 : 05:39:55
i am doing delete from <table> where country='AU'

table is having 250000 records..

select * from sys.sysprocesses i used this query to determine the status its showing status as "Suspended"

Pls help me in this regard.

Go to Top of Page

sumitxmahajan
Starting Member

2 Posts

Posted - 2010-07-23 : 07:20:28
quote:
Originally posted by gangadhara.ms

i am doing delete from <table> where country='AU'

table is having 250000 records..

select * from sys.sysprocesses i used this query to determine the status its showing status as "Suspended"

Pls help me in this regard.

Gangadhara,

Could you check if the growth of the transaction log file is not exceeding the disk space?

Another thing, that you might wanna try, is to, change the database properties for the recovery model from Full to Simple before you run your DELETE command.

Mind it, every recovery model has its own pros & cons. You need to revert it to its earlier stage once you are done. Also, it is advisable to do this activity on the development machine.

All the best!



Regards!
Sumit M.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-23 : 08:23:43
SQL Server 2005 or higher?
Do it in smaller steps.
Try:

while exists(select * from <table> where country='AU')
begin
delete top 100 from <table> where country='AU'
end



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2010-07-23 : 10:09:27
If you are deleting lot of rows,you should be updating statistics in regular basis.
Go to Top of Page
   

- Advertisement -