Contenu connexe
Similaire à 深入解析MySQL之锁机制应用
Similaire à 深入解析MySQL之锁机制应用 (20)
深入解析MySQL之锁机制应用
- 3. 实现功能的SQL语句
• Select 库存数量 from 商品库存表 where 商
品ID=1;
• Insert into 订单表;
• Insert into 付款表;
• Update 商品库存表 set 库存数量=库存数量-
1 where 商品ID=1;
- 4. 为什么需要锁?
• 对有限资源的保护
• 更新丢失问题
• 隔离和并发的矛盾
事务的隔离级别 脏读 不可重复读 幻读
Read uncommited Yes Yes Yes
Read commited No Yes Yes
Repeatable read No No Yes
Serializable no no no
- 17. 影响Innodb锁的几个参数
• tx_isolation
• autocommit
• innodb_table_locks
• innodb_lock_wait_timeout
• innodb_locks_unsafe_for_binlog
- 19. About TechClub
• IT技术沙龙
• 兴趣、分享、公益
• http://www.tech-club.org
• https://groups.google.com/group/tech-club-org
• TechClub@weibo
• TechCluber@twitter
• QQ群:79207910