当前位置:   article > 正文

hive里如何快速查看表中有多少记录数_hive获取数据量

hive获取数据量

方法一:

在hue界面的hive下找到相应的表,即可看到表的行数和大小等信息。



方法二编写脚本,


[root@namenode01 hive]# cat count_tables.sh 

myorder=1
while read line;
do
eval "hive --database tpc_ds -S -e 'select \"$myorder\" as myorder, \"$line\" as tablename, count(*) as rowcount from $line;' &"
myorder=$(($myorder+1));
done;
[root@namenode01 hive]# cat tables.txt 
call_center

执行脚本
sh count_tables.sh  tables.txt 

三种情况 直接从Mysql里查询

mysql> use hive

select * from TBLS where TBL_NAME='call_center';

mysql> select a.TBL_ID, a.TBL_NAME, b.PARAM_KEY, b.PARAM_VALUE from TBLS as a join TABLE_PARAMS as b where a.TBL_ID = b.TBL_ID and TBL_NAME="web_sales" and PARAM_KEY="numRows";
+--------+-----------+-----------+-------------+
| TBL_ID | TBL_NAME  | PARAM_KEY | PARAM_VALUE |
+--------+-----------+-----------+-------------+
|    382 | web_sales | numRows   | -1          |
|    406 | web_sales | numRows   | 144002668   |
+--------+-----------+-----------+-------------+

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/人工智能uu/article/detail/969534
推荐阅读
相关标签
  

闽ICP备14008679号