周梦康 发表于 2018-01-08 1336 次浏览 标签 : Mysql
mysql> explain SELECT SQL_CALC_FOUND_ROWS id  FROM seo_ziliao_article force index(`index_createtime`) WHERE is_delete=0 ORDER BY create_time DESC  LIMIT 22790,10;
+----+-------------+--------------------+-------+---------------+------------------+---------+------+--------+-------------+
| id | select_type | table              | type  | possible_keys | key              | key_len | ref  | rows   | Extra       |
+----+-------------+--------------------+-------+---------------+------------------+---------+------+--------+-------------+
|  1 | SIMPLE      | seo_ziliao_article | index | NULL          | index_createtime | 6       | NULL | 172736 | Using where |
+----+-------------+--------------------+-------+---------------+------------------+---------+------+--------+-------------+
1 row in set (0.00 sec)

mysql> explain SELECT id  FROM seo_ziliao_article force index(`index_createtime`) WHERE is_delete=0 ORDER BY create_time DESC  LIMIT 22790,10;
+----+-------------+--------------------+-------+---------------+------------------+---------+------+-------+-------------+
| id | select_type | table              | type  | possible_keys | key              | key_len | ref  | rows  | Extra       |
+----+-------------+--------------------+-------+---------------+------------------+---------+------+-------+-------------+
|  1 | SIMPLE      | seo_ziliao_article | index | NULL          | index_createtime | 6       | NULL | 22800 | Using where |
+----+-------------+--------------------+-------+---------------+------------------+---------+------+-------+-------------+
1 row in set (0.00 sec)

mysql> explain SELECT id  FROM seo_ziliao_article WHERE is_delete=0;
+----+-------------+--------------------+------+---------------+-----------+---------+-------+-------+-------------+
| id | select_type | table              | type | possible_keys | key       | key_len | ref   | rows  | Extra       |
+----+-------------+--------------------+------+---------------+-----------+---------+-------+-------+-------------+
|  1 | SIMPLE      | seo_ziliao_article | ref  | is_delete     | is_delete | 1       | const | 86368 | Using index |
+----+-------------+--------------------+------+---------------+-----------+---------+-------+-------+-------------+
1 row in set (0.00 sec)

评论列表