数据库
首页 > 数据库> > MySQL 5.7-8.11.2 Table Locking Issues(表锁问题)

MySQL 5.7-8.11.2 Table Locking Issues(表锁问题)

作者:互联网

InnoDB tables use row-level locking so that multiple sessions and applications can read from and write to the same table simultaneously, without making each other wait or producing inconsistent results.

InnoDB表使用行级锁,这样多个会话和应用程序可以同时对同一个表进行读写,而不会导致彼此等待或产生不一致的结果。

For this storage engine, avoid using the LOCK TABLES statement, because it does not offer any extra protection, but instead reduces concurrency.

对于这个存储引擎,避免使用LOCK TABLES语句,因为它不提供任何额外的保护,而是减少并发性。

The automatic row-level locking makes these tables suitable for your busiest databases with your most important data, while also simplifying application logic since you do not need to lock and unlock tables. Consequently, the InnoDB storage engine is the default in MySQL.

自动行级锁定使这些表适合于最繁忙的数据库,其中包含最重要的数据,同时也简化了应用程序逻辑,因为您不需要锁定和解锁表。因此,InnoDB存储引擎是MySQL的默认存储引擎。

MySQL uses table locking (instead of page, row, or column locking) for all storage engines except InnoDB. The locking operations themselves do not have much overhead. But because only one session can write to a table at any one time, for best performance with these other storage engines, use them primarily for tables that are queried often and rarely inserted into or updated.

MySQL对除InnoDB外的所有存储引擎使用表锁(而不是页、行或列锁)。锁操作本身没有太多的开销。但是,由于在任何时候只能有一个会话写入表,因此,为了使用这些其他存储引擎获得最佳性能,主要将它们用于经常查询、很少插入或更新的表。

Performance Considerations Favoring InnoDB

性能考虑,支持InnoDB

When choosing whether to create a table using InnoDB or a different storage engine, keep in mind the following disadvantages of table locking:

当选择是使用InnoDB还是使用不同的存储引擎创建表时,请记住表锁的以下缺点:

Workarounds for Locking Performance Issues

锁定性能问题的解决方案

The following items describe some ways to avoid or reduce contention caused by table locking:

以下内容描述了一些避免或减少表锁引起的争用的方法:

标签:语句,5.7,locking,Locking,会话,InnoDB,MySQL,table,SELECT
来源: https://blog.csdn.net/tangwenqiang177/article/details/121008024