6

I am building a desktop application with back-end in MySQL. Does Mysql Support No Lock or some thing equivalent to this as in sql?

Select * from Tablename (NoLock);

Suppose I am fetching data from multiple tables using join, Then do i Need to implement this code while selecting rows from each and every table?

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
SELECT * FROM 'Table1' 
 iNNERjOIN TABLE2 ON TABLE2.FK=TABLE1.PK ;
COMMIT ;
Shashank
  • 5,827
  • 20
  • 50
  • 71

2 Answers2

12

try this

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
SELECT * FROM Tablename ;
COMMIT ;
PSR
  • 38,073
  • 36
  • 106
  • 149
1

You can set the isolation level in the mysql config file to avoid having to call SET TRANSACTION for every query:

[mysqld] transaction-isolation = READ-UNCOMMITTED

mixmasteralan
  • 479
  • 4
  • 11