-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
高性能 MySQL #1
Labels
MySQL
数据库
Comments
第一章 MySQL 架构和历史锁 MySQL InnoDB 官方文档 graph TB
lock-type[锁类型] --> 加锁机制[加锁机制]
lock-type[锁类型] --> 锁颗粒度[锁颗粒度]
lock-type[锁类型] --> 兼容性[兼容性]
lock-type[锁类型] --> 加锁模式[加锁模式]
加锁模式[加锁模式] --> Intention-Locks[意向锁]
加锁模式[加锁模式] --> Record-Locks[行锁]
加锁模式[加锁模式] --> Gap-Locks[间隙锁]
加锁模式[加锁模式] --> Next-Key-Locks[Next-Key Locks]
加锁模式[加锁模式] --> Insert-Intention-Locks[插入意向锁]
兼容性[兼容性] --> read-lock[读锁/共享锁 S ]
兼容性[兼容性] --> write-lock[写锁/独占锁 X ]
锁颗粒度[锁颗粒度] --> 表级锁[表级锁]
锁颗粒度[锁颗粒度] --> 行级锁[行级锁]
加锁机制[加锁机制] --> 乐观锁[乐观锁]
加锁机制[加锁机制] --> 悲观锁[悲观锁]
间隙锁、行锁、Next-Key Locks
意向锁意向锁是表级锁,用来标记操作意向,提高性能
插入意向锁(Insert Intention Locks)插入意向锁不是意向锁,而是一种特殊的间隙锁,只需要插入行记录并不冲突,就可以在同一区间范围内插入 锁类型兼容性
事务 graph TB
事务[事务] --> 原子性[原子性]
事务[事务] --> 隔离性[隔离性]
事务[事务] --> 一致性[一致性]
事务[事务] --> 持久性[持久性]
隔离性[隔离性] --> 未提交读[READ UNCOMMITTED]
隔离性[隔离性] --> 提交读[READ COMMITTED]
隔离性[隔离性] --> 可重复读[REPEATABLE READ]
隔离性[隔离性] --> 串行[SERIALIZABLE]
一致性非锁定读(Consistent Nonlocking Reads)一致性非锁定读是按照版本号读取数据,无需加锁就能读取数据,在不同的隔离级别有不同的行为。
死锁在 MySQL InnoDB 中检测到事务等待列表超过200个也会被视为死锁,一旦检测到发生死锁,InnoDB 会回滚最小事务(由插入、更新或删除的行数决定)
Buffer Pool
|
第五章 索引InnoDB索引的结构
常用索引类型
# a 和 b 是组合索引,(a, b)
# 想要使用使用这个组合索引必须要有a,但是也不是有查询a的条件就一定会走索引
select * from tb where a = 10 and b = 20; EXPLAIN 的使用 索引优化
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: