I need to find out the number of tables created in each schemas and find out the size occupied by each schema.
Asked
Active
Viewed 5,284 times
1 Answers
2
This is possible to do using shell script
Calculate the rows in command output
hive -S -e "set hive.cli.print.header=false; use $schema; show tables;" | wc -l
Where $schema is your schema nameThe size of schema is a little bit tricky. Each table in the schema can have it's own location in HDFS that is different from schema default location. You need to loop through schema tables (see previous command),
describe formatted each table
, parse table location, get location size and sum all table locations size in HDFS. To get table location size use this command:hdfs hadoop fs -du [table location]
.

leftjoin
- 36,950
- 8
- 57
- 116
-
Thanks alot for your help – user5717949 Feb 07 '17 at 05:23