CDH实操--hive表及分区检查
1)DB数量
select count(1) from DBS;
2)各DB中的TABLE数量
select TBLS.db_id, name, count(1) tab_num from TBLS join DBS on TBLS.db_id = DBS.db_id group by db_id, name having tab_num >= 20 order by tab_num desc;
3)各TABLE的PARTITION数量
select TBLS.tbl_id, tbl_name, count(1) as part_num from PARTITIONS join TBLS on PARTITIONS.tbl_id = TBLS.tbl_id group by tbl_id, tbl_name order by part_num desc limit 30;
4)各DB中所有TABLE的PARTITION总量
select DBS.db_id,name,count(1) as part_num from PARTITIONS, TBLS, DBS where PARTITIONS.tbl_id = TBLS.tbl_id and TBLS.db_id = DBS.db_id group by db_id, name order by part_num desc limit 30;
5)TBL_COL_PRIVS和TBL_PRIVS的数据量
TBL_PRIVS、TBL_COL_PRIVS:记录该hive表的表及列权限认证信息