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
  • 6,117
  • 20
  • 51
  • 72

2 Answers2

12

try this

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
SELECT * FROM Tablename ;
COMMIT ;
PSR
  • 39,804
  • 41
  • 111
  • 151
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
  • 489
  • 4
  • 11