We might need to know the database size for a variety of reasons, such as capacity planning, storage allocations, and so on. The following methods can be used to determine the database size in Apache Hive.
hdfs dfs -du -h /user/hive/warehouse
The command above will assist in determining the size of each database in the warehouse.
hdfs dfs -du -h /user/hive/warehouse/<db_name>
The above command will let you know the size of the table in a specific database.
Note: Change the path according to the warehouse directory in your machine.
If you are using, Cloudera VM, you can use the below command to list out all the databases.
hadoop fs -ls /user/cloudera/hive/warehouse
The below command will help in identifying the size of each database.
hadoop fs -du -s -h /user/cloudera/hive/warehouse/{db_name}
Hope you find this article helpful.
Please subscribe for more interesting updates.