Select Count (*)和Select Count(1)以及Select Count(column)的区别
2011-09-03 08:29
519 查看
一般情况下,两着返回结果是一样的
假如表沒有主键(Primary key), 那么count(1)比count(*)快
如果有主键的話,那主键作为count的条件时候count(主键)最快
如果你的表只有一个字段的话那count(*)就是最快的
count(*) 跟 count(1) 的结果一样,都包括对NULL的统计
count(column) 是不包括NULL的统计
假如表沒有主键(Primary key), 那么count(1)比count(*)快
如果有主键的話,那主键作为count的条件时候count(主键)最快
如果你的表只有一个字段的话那count(*)就是最快的
count(*) 跟 count(1) 的结果一样,都包括对NULL的统计
count(column) 是不包括NULL的统计
相关文章推荐
- Select Count (*)和Select Count(1)以及Select Count(column)区别
- Select Count (*)和Select Count(1)以及Select Count(column)区别
- Select Count (*)和Select Count(1)以及Select Count(column)的区别
- select count (*)、count(1)、count(column)的区别
- Count (*),Select Count(1),Select Count(column)的区别
- 查询数量 简单分析count(1) count(*)以及count(column)的区别
- InitializeCriticalSectionAndSpinCount以及InitializeCriticalSection的区别
- select count(*)和select count(1)的区别
- SQL Server DBCC & Count (*) Count(1) ,Select Count(column)
- select count(*)和select count(1)的区别
- SQL Select count(*)和Count(1)的区别和执行方式及SQL性能优化
- select标签下option标签里value属性有什么用以及和text的区别
- select count(1) 和 select count(*)的区别
- sql select * ,select 1, select count(*) ,select count(1)的区别
- select count(*)和select count(1)的区别
- mysql函数count(*)和count(column)的区别
- select * from 与select count(*) from 的区别
- Select count(*)和Count(1)的区别和执行方式
- 论证select count(*)和select count(1)的区别
- select count(*) from temp 与select count(1) from temp有什么区别