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   |
+--------+-----------+-----------+-------------+

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值