biotwang 发表于 2016-7-20 11:46:00

【dbdao.com MySQL OCP认证专题】- MySQL 5.6 - OCP 考题讲解 - 12

【dbdao.com MySQL OCP认证专题】- MySQL 5.6 - OCP 考题讲解

12.

Which two statements are true about InnoDB auto-increment locking?

A. The auto-increment lock can be a table-level lock.
B. InnoDB never uses table-level locks.
C. Some settings for innodb_autoinc_lock_mode can help reduce locking.
D. InnoDB always protects auto-increment updates with a table-level lock.
E. InnoDB does not use locks to enforce auto-increment uniqueness.
--------------------------------------

答案:A, C

分析:
auto-increment的AUTO-INC锁是一个表级锁,因此A正确,B和E错误,。
C正确,根据数据库参数innodb_autoinc_lock_mode的设置,插入操作会根据模式和所用语句的不同选用相应的锁。
innodb_autoinc_lock_mode = 2的时候,将不使用表级锁和轻量mutex锁,不过在基于语句复制(SBR: Statement Based Replication)时,会有交错序列风险。

参考:
http://dev.mysql.com/doc/refman/5.7/en/innodb-auto-increment-handling.html
http://dev.mysql.com/doc/refman/5.7/en/innodb-auto-increment-configurable.html
页: [1]
查看完整版本: 【dbdao.com MySQL OCP认证专题】- MySQL 5.6 - OCP 考题讲解 - 12