我有一张230 000行的表
查询1持续时间1,389秒
SELECT sql_no_cache `model_regulation_sections`.*
FROM `model_regulation_sections`
WHERE `model_regulation_sections`.`regulation_id` = 254
ORDER BY `model_regulation_sections`.`lft` ASC
LIMIT 20
说明
select_type = SIMPLE
table = model_regulation_sections
partitions = null`
type = index
possible_keys = document_id
key = lft
key_len = 4
ref = null
rows = 2229
过滤= 0.90
额外=使用在哪里
查询2持续时间0,0067
SELECT sql_no_cache `model_regulation_sections`.*
FROM `model_regulation_sections`
WHERE `model_regulation_sections`.`regulation_id` = 254
ORDER BY `model_regulation_sections`.`lft` ASC
LIMIT 21
说明
select_type = SIMPLE
table = model_regulation_sections
partitions = null`
type = ref
possible_keys = document_id
key = lft
key_len = 4
ref = const
rows = 2251
过滤= 100
额外= 'Using index condition; Using filesort'
MySQL为什么将限制从20增加到21会将执行时间从1,4s减少到0,0067s?
为什么2小时前查询1的执行时间是13.5秒?我没有更改配置 .