hive裡如何快速查看錶中有多少記錄數
方法一:
在hue介面的hive下找到相應的表,即可看到表的行數和大小等資訊。
方法二編寫指令碼,
[[email protected] hive]# cat count_tables.sh
myorder=1while 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;
[[email protected]
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 |
+--------+-----------+-----------+-------------+