select distinct id from out where isBol=‘1’ order by id这个如何优化
explain 如下
走了索引 idx_OH_isHistory
Using where; Using index; Using temporary; Using filesort+----+-------------+-----------------+------+------------------+------------------+---------+-------+--------+-----------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------------+------+------------------+------------------+---------+-------+--------+-----------------------------------------------------------+
| 1 | SIMPLE | Out | ref | idx_OH_isHistory | idx_OH_isHistory | 3 | const | 358110 | Using where; Using index; Using temporary; Using filesort |
+----+-------------+-----------------+------+------------------+------------------+---------+-------+--------+-----------------------------------------------------------+
1 row in set用Jet Profiler for MySQL 工具来检查发现他有5 red circles。
显然需要优化 。 问题 是这样的sql如何才能 优化 。??? (这个sql也太简单了啊)
explain 如下
走了索引 idx_OH_isHistory
Using where; Using index; Using temporary; Using filesort+----+-------------+-----------------+------+------------------+------------------+---------+-------+--------+-----------------------------------------------------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------------+------+------------------+------------------+---------+-------+--------+-----------------------------------------------------------+
| 1 | SIMPLE | Out | ref | idx_OH_isHistory | idx_OH_isHistory | 3 | const | 358110 | Using where; Using index; Using temporary; Using filesort |
+----+-------------+-----------------+------+------------------+------------------+---------+-------+--------+-----------------------------------------------------------+
1 row in set用Jet Profiler for MySQL 工具来检查发现他有5 red circles。
显然需要优化 。 问题 是这样的sql如何才能 优化 。??? (这个sql也太简单了啊)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货