根据MySQL manual :
For large tables, table locking is often better than row locking,
这是为什么?我认为行级锁定更好,因为当您锁定更大的表时,您会锁定更多数据。
最佳答案
来自(预编辑)link
Slower than page-level or table-level locks when used on a large part of the table because you must acquire many more locks
如果您只命中一两行,请使用行级锁。如果您的代码命中许多行或未知行,请坚持使用表锁。
关于mysql - 为什么大表的表级锁定优于行级锁定?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3462643/