We have a website using ASP.NET MVC and SQL Server 2008 and we are using the default transactionscope isolation level which is Serializable. But it makes the application unusable if any transaction is opened as we have a table that being used by almost everything and it runs like
select * from table1 where id = 1
So I think it locks the whole table when the above is executed.
I have been reading what could be the best option for web application with lot of transactions.
I am kind of sold on Snapshot isolation level. Which give the best of everything:
- Data protection when read data is changed by throwing error.
- Also allows read of data that's in transaction.
Which isolation level could be for web application as per your experience?
Edit: Default isolation level is from transactionscope, just to clarify why I mentioned serializable as default.
I read lots of blogs and answers here suggesting using no_lock for select, but that is kind of a hack if you ask me. In a real life scenario maybe 99.99% of the time it will be OK. And that is something fine for Facebook, Twitter or Stack Overflow. Who cares if data is corrupted. But my take on it is if we use transaction isolation then it must be 100% guaranteed architecture. Otherwise don't use it at all and add some other data integrity checks with a trigger or something.