MySQL之count(*)与count(id)效率比较(转)
优化总结:
1.任何情况下SELECT COUNT(*) FROM tablename是最优选择;
2.尽量减少SELECT COUNT(*) FROM tablename WHERE COL = ’value’ 这种查询;
3.杜绝SELECT COUNT(COL) FROM tablename的出现。
详情:http://hi.baidu.com/wrjgg/item/f5b823b4e1dca79918469729
Your future depends on your dreams. So go to sleep.
优化总结:
1.任何情况下SELECT COUNT(*) FROM tablename是最优选择;
2.尽量减少SELECT COUNT(*) FROM tablename WHERE COL = ’value’ 这种查询;
3.杜绝SELECT COUNT(COL) FROM tablename的出现。
详情:http://hi.baidu.com/wrjgg/item/f5b823b4e1dca79918469729