小编rat*_*ace的帖子

为什么这个简单的查询需要超过 1 秒?

该表有大约 1700 万行,是 MyISAM。

select DateModified,PELTM,PSLTM 
from financial_key_ratios 
where SecurityId = 4525 
  and DateModified >= '2015-01-07';
Run Code Online (Sandbox Code Playgroud)

这个简单的查询似乎需要超过 1 秒的时间。

索引似乎没问题。这是解释的输出:

 explain 
 select DateModified,PELTM,PSLTM 
 from financial_key_ratios 
 where SecurityId = 4525 
   and DateModified >= '2015-01-07';
+----+-------------+----------------------+-------+------------------------------------------------+------------+---------+------+------+-------------+
| id | select_type | table                | type  | possible_keys                                  | key        | key_len | ref  | rows | Extra       |
+----+-------------+----------------------+-------+------------------------------------------------+------------+---------+------+------+-------------+
|  1 | SIMPLE      | financial_key_ratios | range | SecurityId,secid,DateModified_index,secid_date | secid_date | 7       | NULL |  156 | Using where |
+----+-------------+----------------------+-------+------------------------------------------------+------------+---------+------+------+-------------+
Run Code Online (Sandbox Code Playgroud)

我们可能做错了什么? …

mysql performance slow-log

5
推荐指数
1
解决办法
1614
查看次数

标签 统计

mysql ×1

performance ×1

slow-log ×1