mysql 索引对于select速度提升作用实验
说明;News2在News的基础上把is_active加上索引。
mysql> select count(*) from News2 where is_active=1;
+----------+
| count(*) |
+----------+
| 7820331 |
+----------+
1 row in set (14.77 sec)
mysql> select count(*) from News2 where is_active=0;
+----------+
| count(*) |
+----------+
| 7797380 |
+----------+
1 row in set (14.56 sec)
mysql> select count(*) from News where is_active=0;
+----------+
| count(*) |
+----------+
| 7797380 |
+----------+
1 row in set (35.20 sec)
mysql> select count(*) from News where is_active=1;
+----------+
| count(*) |
+----------+
| 7820331 |
+----------+
1 row in set (35.12 sec)