-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Do I really need a transaction?
PostPosted: Thu Mar 23, 2006 1:52 pm 
Newbie

Joined: Thu Mar 23, 2006 1:42 pm
Posts: 4
I have inheritted a project that uses NHibernate and have run into some performance issues. The code has wrapped every call to the db in a transaction whether records are updated or just selected. The CommittTransaction on all of the Selects is putting a hefty ding in performance. Is it really necessary to use a transaction if all you're doing is selecting data from the db?

I know outside of NHibernate that you wouldn't need a transaction, but wasn't sure if NHibernate needed the transaction for something.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 23, 2006 2:51 pm 
Contributor
Contributor

Joined: Thu May 12, 2005 8:45 am
Posts: 226
I wouldn't think a transaction on a read-only operation makes sense either, but IANAL.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 23, 2006 3:24 pm 
Regular
Regular

Joined: Tue Feb 07, 2006 4:27 pm
Posts: 69
Hi,

I'm an ex-DBA and have quite a bit of experience with query performance.

I don't think that a Transaction is needed when you are purely doing
a read.

If you are doing a read with the intent to modify data I would suggest
that you perform that read within a Transaction so that the proper database locks can occur from the time your transaction begins and you issue the commit.

Keep in mind, you want to keep the transactions as small as possible, if possible to avoid holding onto a lock for an extended period of time.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.