周梦康 发表于 2018-01-08 428 次浏览 标签 : Mysql

免费领取阿里云优惠券 我的直播 - 《PHP 进阶之路》

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)

嗨,老铁,欢迎来到我的博客!

如果觉得我的内容还不错的话,可以关注下我在 segmentfault.com 上的直播。我主要从事 PHP 和 Java 方面的开发,《深入 PHP 内核》作者之一。

[视频直播] PHP 进阶之路 - 亿级 pv 网站架构的技术细节与套路 直播中我将毫无保留的分享我这六年的全部工作经验和踩坑的故事,以及会穿插着一些面试中的 考点难点加分点

评论列表