38万行
奇怪的是count(Id)会更快, mysql 5.5.37
mysql> SELECT count(*) FROM `dueros_ji_fen` where appid='2faa1610-f0e2-61bd-82ce-cc872d2748f6';
+----------+
| count(*) |
+----------+
| 188581 |
+----------+
1 row in set (0.96 sec)
mysql> SELECT count(*) FROM `dueros_ji_fen` where appid='2faa1610-f0e2-61bd-82ce-cc872d2748f6';
+----------+
| count(*) |
+----------+
| 188581 |
+----------+
1 row in set (0.96 sec)
mysql> SELECT count(1) FROM `dueros_ji_fen` where appid='2faa1610-f0e2-61bd-82ce-cc872d2748f6';
+----------+
| count(1) |
+----------+
| 188592 |
+----------+
1 row in set (0.74 sec)
mysql> SELECT count(appid) FROM `dueros_ji_fen` where appid='2faa1610-f0e2-61bd-82ce-cc872d2748f6';
+--------------+
| count(appid) |
+--------------+
| 188593 |
+--------------+
1 row in set (0.47 sec)
mysql> SELECT count(Id) FROM `dueros_ji_fen` where appid='2faa1610-f0e2-61bd-82ce-cc872d2748f6' and chatnumber>189;
+-----------+
| count(Id) |
+-----------+
| 1838 |
+-----------+
1 row in set (0.01 sec)
mysql> SELECT count(Id) FROM `dueros_ji_fen` where appid='2faa1610-f0e2-61bd-82ce-cc872d2748f6' ;
+-----------+
| count(Id) |
+-----------+
| 188611 |
+-----------+
1 row in set (0.67 sec)
评论已关闭!