Hi all,
I have a table which contain 60 colums and appropriate clustered and non clustered index and 50 lacs data. Now i want to move some useless data into any other table. when i insert in other table it takes 5 to 7 minuts per 10 lacs data. now when in delete this data from main table it takes around 40 or more than 40 minuts. Please advice me how to reduce this.
urgent for me.
I am deleting data according to date means datewise.
Please help.
Loading


Iftikar HussainRank #423 · 5.9K reputationPosted Jul 9, 2013, 10:52 PM EDT
Please provide your sql query and table schema.
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 9, 2013, 10:55 PM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 9, 2013, 11:12 PM EDT
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 9, 2013, 11:26 PM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 9, 2013, 11:52 PM EDT
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 9, 2013, 11:52 PM EDT
this query....
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 9, 2013, 11:57 PM EDT
Regards,
Iftikar
Kunal VaishyaRank #990 · 2K reputationPosted Jul 10, 2013, 12:33 AM EDT
Delete from wms_loose_transaction
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 10, 2013, 12:41 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 10, 2013, 12:44 AM EDT
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 10, 2013, 12:57 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 10, 2013, 1:02 AM EDT
also check your sql log file size
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 10, 2013, 1:22 AM EDT
Log file size is 4.41 gb and mdf size is 11.3 gb.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 10, 2013, 1:53 AM EDT
Regards,
Iftikar
Kunal VaishyaRank #990 · 2K reputationPosted Jul 10, 2013, 1:58 AM EDT
Refer link
http://msdn.microsoft.com/en-us/library/ms188232(v=sql.105).aspx
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 10, 2013, 2:05 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 10, 2013, 2:28 AM EDT
have you tried this
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 10, 2013, 3:23 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 10, 2013, 4:32 AM EDT
select count(*) from wms_loose_transaction
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 10, 2013, 7:49 PM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 10, 2013, 8:26 PM EDT
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 10, 2013, 8:37 PM EDT
I already shrinked my log file but. still taking time. I am really in trouble.
I have to control 5 databases at 5 different location.and they all having same problem.
Please help me anyone.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 10, 2013, 9:26 PM EDT
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 10, 2013, 9:41 PM EDT
please find the attachment.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 10, 2013, 9:52 PM EDT
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 10, 2013, 9:59 PM EDT
It returns 2 lacs row
But It returns 0
y???
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 10, 2013, 9:59 PM EDT
It returns 2 lacs row
But It returns 0 rows
y???
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 10, 2013, 10:11 PM EDT
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 10, 2013, 10:21 PM EDT
It takes 6 minuts to delete 10k records
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 10, 2013, 10:33 PM EDT
http://stackoverflow.com/questions/478327/multi-rows-deletion-from-table-in-sql-server
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 11, 2013, 12:20 AM EDT
i got a solution.
1. First of all I created a table tempPUT from wms_loose_transaction
2. After that I created a table tempDSP from wms_loose_transaction
3.truncate table wms_loose_transaction
4.insert into wms_loose_transaction select * from tempPUT
I have done above task within 5 minut. Please suggest me following process is right or
any error occur in future or any accuracy problem will happen???
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 11, 2013, 12:56 AM EDT
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 11, 2013, 1:24 AM EDT
in this situation???
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 11, 2013, 8:10 AM EDT
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 12, 2013, 3:12 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 12, 2013, 3:18 AM EDT
Regards,
Iftikar
Ravi ShekharRank #673 · 3.6K reputationPosted Jul 12, 2013, 4:00 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 12, 2013, 4:12 AM EDT
Regards,
Iftikar