时间:2021-07-01 10:21:17 帮助过:2人阅读
作用上来说是没有差别的,都是查看是否有记录,一般是作条件用的.
看得出执行效率为: select 1 > select 1 from table > select anycolum from table > select * from table
再来看看 count(*) 和 count(1)的效率。
+----------+------------+------------------------------------+ | Query_ID | Duration | Query | +----------+------------+------------------------------------+ | 7 | 0.00037200 | select count(1) from smily_test | | 8 | 0.00034500 | select count(*) from smily_test | +----------+------------+------------------------------------+
mysql select 1
标签: