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)
 nested transactions and performance

Author  Topic 

Kanati
Starting Member

36 Posts

Posted - 2006-02-21 : 16:06:40
This is on an SQL7 server... My boss has a significant amount of code that has nested transactions. Basically it's all coming in or none of it (which is one of the reasons I'm questioning this).

pseudocode sample of a possible run


TRANSACTION
TRANSACTION
TRANSACTION : END TRANSACTION
TRANSACTION : END TRANSACTION
TRANSACTION : END TRANSACTION
END TRANSACTION
TRANSACTION
TRANSACTION : END TRANSACTION
END TRANSACTION
TRANSACTION
TRANSACTION : END TRANSACTION
TRANSACTION : END TRANSACTION
TRANSACTION : END TRANSACTION
END TRANSACTION
TRANSACTION
TRANSACTION : END TRANSACTION
TRANSACTION : END TRANSACTION
TRANSACTION : END TRANSACTION
TRANSACTION : END TRANSACTION
TRANSACTION : END TRANSACTION
END TRANSACTION
END TRANSACTION


What kind of performance hit, if any is that going to cause? Because right now that entire process is incredibly slow. I told him I think it's all of the nested transactions and that he should just have one main transaction since it's an all or nothing situation anyway. Note that other routines are getting called for each smaller "batch" you are seeing in the pseudocode above.

X002548
Not Just a Number

15586 Posts

Posted - 2006-02-21 : 16:22:43
One way to prove that...clone all of the code, remove the transaction and run it.

Personally nesting will cause you confusion more so than performance hits...But I wouldn't really know, because I never do this.

Got any CURSORs in there?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page

Kanati
Starting Member

36 Posts

Posted - 2006-02-21 : 16:39:09
no cursors but there are a couple of while loops.
Go to Top of Page
   

- Advertisement -