count(*) where 速度慢

2019-03-22 22:18 阅读 902 views 次 count(*) where 速度慢已关闭评论

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)

版权声明:本文著作权归原作者所有,欢迎分享本文,谢谢支持!
转载请注明:count(*) where 速度慢 | 蚂蚁浏览器文档
分类:电脑技术 标签:

评论已关闭!