为了实现大规模、繁忙或高可靠性的数据库应用,从其他数据库系统迁移大量代码,或优化 MySQL 性能,理解 InnoDB 锁定和 InnoDB 事务模型非常重要。To implement a large-scale, busy, or highly reliable database
application, to port substantial code from a different database
system, or to tune MySQL performance, it is important to understand
InnoDB locking and the InnoDB
transaction model.
本节讨论了与InnoDB锁定和InnoDB事务模型相关的几个主题,您应该熟悉这些内容。This section discusses several topics related to
InnoDB locking and the InnoDB
transaction model with which you should be familiar.
第 17.7.1 节,“InnoDB 锁定” 描述了
InnoDB使用的锁类型。Section 17.7.1, “InnoDB Locking” describes lock types used byInnoDB.第 17.7.2 节,“InnoDB 事务模型” 描述了事务隔离级别及每种隔离级别使用的锁策略。它还讨论了
autocommit的使用、一致非锁定读和锁定读。Section 17.7.2, “InnoDB Transaction Model” describes transaction isolation levels and the locking strategies used by each. It also discusses the use ofautocommit, consistent non-locking reads, and locking reads.第 17.7.3 节,“InnoDB 中由不同 SQL 语句设置的锁” 讨论了
InnoDB对各种语句设置的特定锁类型。Section 17.7.3, “Locks Set by Different SQL Statements in InnoDB” discusses specific types of locks set inInnoDBfor various statements.第 17.7.4 节,“幻影行” 描述了
InnoDB如何使用下一个键锁来避免幻影行。Section 17.7.4, “Phantom Rows” describes howInnoDBuses next-key locking to avoid phantom rows.第 17.7.5 节,“InnoDB 中的死锁” 提供了一个死锁示例,讨论了死锁检测,并提供了在
InnoDB中最小化和处理死锁的技巧。Section 17.7.5, “Deadlocks in InnoDB” provides a deadlock example, discusses deadlock detection, and provides tips for minimizing and handling deadlocks inInnoDB.