美文网首页
hive中 count(1),count(*),count(某字

hive中 count(1),count(*),count(某字

作者: 进击的小恶魔 | 来源:发表于2020-04-13 02:04 被阅读0次

区别

count(*):所有行进行统计,包括NULL行
count(1):所有行进行统计,包括NULL行
count(column):对column中非Null进行统计

性能

性能实际上差不多
count(id)的时候多了一个Select operator;
count(id)的Group By Operator 的 aggregations过程略有不同

扩展

mysql count(1) 和 count(*) 区别

查询条件中没有索引时,count(*)比count(1)查询速度要快些。
查询条件中有索引时,count(1)比count(*)查询速度要快些。

资料:https://blog.csdn.net/p6620582/article/details/93785360

相关文章

网友评论

      本文标题:hive中 count(1),count(*),count(某字

      本文链接:https://www.haomeiwen.com/subject/xulwmhtx.html