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
 SQL Server Development (2000)
 delete acting weird

Author  Topic 

thanksfor help
Posting Yak Master

106 Posts

Posted - 2009-01-12 : 13:41:51
Hi,

I have a stored procedure to create a table of about 120K records on each run. It takes about 50sec to complete. The stored proceudre uses temp tables for all the calculation and in the end drops and recreate the perm table and inserts the value. Currently, I added few lines of code to delete set of few thousands of records based on few date condition to the temp table and then do all the calculation. This make the stored procedure to run for 10 mins., if I change the delete to end of all calculation then it runs for 2 mins.

Any idea why the placing of delete makes this difference. Otherwise the logic works fine.

thanks in advance,

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-01-12 : 14:32:43
Maybe interleaving DDL and DDL commands causing it to recompile or Locking/Blocking Issues.
Go to Top of Page

rohitkumar
Constraint Violating Yak Guru

472 Posts

Posted - 2009-01-12 : 15:22:35
may be at the end of all calculation there are fewer records to delete
Go to Top of Page
   

- Advertisement -