没有锁定 mysql
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16890415/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
NO lock in mysql
提问by Shashank
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?
我正在用 MySQL 构建一个带有后端的桌面应用程序。Mysql 是否支持 No Lock 或一些与 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?
假设我使用 join 从多个表中获取数据,那么我是否需要在从每个表中选择行时实现此代码?
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
SELECT * FROM 'Table1'
iNNERjOIN TABLE2 ON TABLE2.FK=TABLE1.PK ;
COMMIT ;
回答by PSR
try this
尝试这个
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
SELECT * FROM Tablename ;
COMMIT ;
回答by mixmasteralan
You can set the isolation level in the mysql config file to avoid having to call SET TRANSACTION for every query:
您可以在 mysql 配置文件中设置隔离级别,以避免必须为每个查询调用 SET TRANSACTION:
[mysqld] transaction-isolation = READ-UNCOMMITTED
[mysqld] 事务隔离 = READ-UNCOMMITTED