NHibernate, Should i use ReadCommitted or ReadUncommited Transaction Isolation Level?
In a large business, should i use ReadCommitted or ReadUncommited Transaction Isolation Level by default whe开发者_如何学Pythonn using NHibernate ?
By using ReadCommitted isolation, i've been facing in some locking on SELECT (Query) statements that become slow.
Well, if you're using SqlServer and have problems with ReadCommitted timeouts/locks, this is easily explainable. You probably just have to run this:
ALTER DATABASE your_db SET SINGLE_USER WITH ROLLBACK IMMEDIATE ;
ALTER DATABASE your_db SET READ_COMMITTED_SNAPSHOT ON;
ALTER DATABASE your_db SET MULTI_USER;
try this and then retest your readcommitted approach. I would stick to it.
The core of the question:
Should i use ReadCommitted or ReadUncommited Transaction Isolation Level ?
Well, they can give different results. So you're actually asking:
Can I use use different result-sets when that is faster?
The answer depends on the application, only you can decide. But in general customers, especially large businesses, are not very tolerant to this.
精彩评论