Support Questions

Find answers, ask questions, and share your expertise

How to check the size of Hive view table?

avatar
Explorer

Hello,

 

I am unable to know the size of the hive table. Actually it is a view specifically which we wanted to know the size of.

 

I have tried by running commands such as hdfs dfs -du -s -h /path/to/table, but the view can't be found in the location.

 

beeline> describe formatted/extended table name; Also does not give the output 

 

I also tried with ANALYZE but no output as well.

 

Can some one tell me how to know the size of the view table. Since we have created view of the different table in database. 

 

And we want to know the size of the particular table.

1 ACCEPTED SOLUTION

avatar
Expert Contributor

@ateka_18 

 

As mentioned before as well, view is just a query statement in HMS. It's not actually a table. If you want to know the size of the table, below is the best approach.

 

hdfs dfs -du -s -h /path/to/table

 

Let's say you have a table named test(/user/hive/warehouse/default.db/test) and have several partitions under it (part1, part2, part3). To get the size of the table.

 

hdfs dfs -du -s -h /user/hive/warehouse/default.db/test

 

Let me know if the above helps.

View solution in original post

6 REPLIES 6

avatar
Expert Contributor

Hi Ateka,

 

Can you share what error you are getting. while submitting the command to better understand the issue.

avatar
Explorer

these is the error I got:

 

Error: Error while compiling statement: FAILED: SemanticException [Error 10091]: ANALYZE is not supported for views (state=42000,code=10091)
 
Please suggest any other command for views. 

avatar
Expert Contributor

@ateka_18 

 

VIEW is just a query statement saved in HMS. So basically its the size of the table you gather and to do so, the best option is below.

 

hdfs dfs -ls <path of the table>

 

With regards to the error you are observing, it clearly says that analyze table is not supported for views. You can get the same for tables.

avatar
Explorer

@tusharkathpal 

 

Thanks for the explanation.

 

Are you sure there is no other way to know the size of the view table.

 

I tried with hdfs dfs -ls command but we have tables in partition so not able to locate the exact table.

 

I can check the size by running hdfs dfs -du -s -h on the path on different directories and sub directories.

 

A quick reply will be highly appreciated.

avatar
Expert Contributor

@ateka_18 

 

As mentioned before as well, view is just a query statement in HMS. It's not actually a table. If you want to know the size of the table, below is the best approach.

 

hdfs dfs -du -s -h /path/to/table

 

Let's say you have a table named test(/user/hive/warehouse/default.db/test) and have several partitions under it (part1, part2, part3). To get the size of the table.

 

hdfs dfs -du -s -h /user/hive/warehouse/default.db/test

 

Let me know if the above helps.

avatar
Explorer

Thanks a lot @tusharkathpal  for your detailed explanation. Your suggestion has really worked.