🔄Update: MySQL
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# 联合索引
|
||||
|
||||
- 二级索引的一种
|
||||
|
||||
## 最左匹配
|
||||
|
||||
有序 -> 匹配
|
||||
|
||||
## 范围查询
|
||||
|
||||
> Q: `select * from t_table where a > 1 and b = 2` 联合索引(a, b)哪一个字段用到了联合索引的 B+Tree?
|
||||
|
||||
|
||||
- a
|
||||
- 在符合 `a > 1` 条件的 `b` 中,字段值是无序的。
|
||||
|
||||
> Q: `select * from t_table where a >= 1 and b = 2` 联合索引(a, b)哪一个字段用到了联合索引的 B+Tree?
|
||||
|
||||
- a, b
|
||||
- 因为能确定唯一起始点
|
||||
|
||||
## 索引下推
|
||||
|
||||
- 提前判断减少回表
|
||||
Reference in New Issue
Block a user