Nolock in mysql ,NOLOCK equivalent in MySQL

Sql Server look like this:

SELECT * FROM PURCHASEENTRY(nolock);
To accomplish the same in MySQL server you can change the session isolation mode using SET SESSION command.

Mysql nolock is single statement works on many tables

Mysql look like this:
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
SELECT * FROM PURCHASEENTRY;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ ;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
SELECT * FROM Tablename ;
COMMIT ;

The above statement will work like WITH (nolock) i.e READ UNCOMMITTED data. 

You can also set the isolation level globally for all connections.

SET GLOBAL TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
#NolockMysql #Nolock #MysqlNolockEqualent

Post a Comment

0 Comments