-
1. Re: newbie: em.flush() is locking a select statement
jaikiran Mar 20, 2008 7:04 AM (in response to mars1412)Since the data is not yet committed, the select statement is blocked to avoid reading stale data. In MSSQL server, there's a option to provide a nolock hint to the server through the select query. However AFAIK, MySQL doesn't have such a hint. Try doing this:
set transaction isolation level READ UNCOMMITTED; select * from MyEntity where id = 1;
See if it works. -
2. Re: newbie: em.flush() is locking a select statement
mars1412 Mar 20, 2008 7:59 AM (in response to mars1412)ah, thanks
you pointed me in the right direction
after some investigations I found out, that the READ_COMMITED transaction isolation level behaves differently between oracle and MS Sql server.
SQL Server uses shared locks by default. Thus the select statement is blocked while the update is not commited yet.
If you set READ_COMMITTED_SNAPSHOT to ON for your database, then it uses row-versioning (like Oracle's default mode): and the select will not be blocked until the update is commited.
I think this behaviour can improve performance on my webapplication.
more information on this:
http://msdn2.microsoft.com/en-us/library/ms173763.aspx
http://msdn2.microsoft.com/en-us/library/tcbchxcb(VS.80).aspx