1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-20 22:17:09 +08:00

Merge pull request #1932 from allen001/patch-2

Update mysql-index.md
This commit is contained in:
Guide 2023-02-28 22:00:05 +08:00 committed by GitHub
commit 50c329d711
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -278,7 +278,7 @@ SELECT id FROM table WHERE id=1;
索引失效也是慢查询的主要原因之一,常见的导致索引失效的情况有下面这些:
- 使用 `SELECT *` 进行查询;
- 创建了组合索引,但查询条件未守最左匹配原则;
- 创建了组合索引,但查询条件未守最左匹配原则;
- 在索引列上进行计算、函数、类型转换等操作;
- 以 `%` 开头的 LIKE 查询比如 `like '%abc'`;
- 查询条件中使用 or且 or 的前后条件中有一个列没有索引,涉及的索引都不会被使用到;