Skip to main content

how to get hive table size from metastore mysql

select    d.name  as db_name
,t.tbl_name     as tbl_name
,from_unixtime(min(t.create_time))   as create_time
,min(t.owner)          as owner
,min(case when tp.param_key = 'COLUMN_STATS_ACCURATE'  then tp.param_value                 end) as COLUMN_STATS_ACCURATE
,min(case when tp.param_key = 'last_modified_by'       then tp.param_value                 end) as last_modified_by
,min(case when tp.param_key = 'last_modified_time'     then from_unixtime(tp.param_value)  end) as last_modified_time 
,min(case when tp.param_key = 'numFiles'               then tp.param_value                 end) as numFiles
,min(case when tp.param_key = 'numRows'                then tp.param_value                 end) as numRows
,min(case when tp.param_key = 'rawDataSize'            then tp.param_value                 end) as rawDataSize
,min(case when tp.param_key = 'totalSize'              then tp.param_value                 end) as totalSize
,min(case when tp.param_key = 'transient_lastDdlTime'  then from_unixtime(tp.param_value)  end) as transient_lastDdlTime

from DBS as d
join TBLS as t
on t.db_id = d.db_id
join TABLE_PARAMS  as tp
on tp.tbl_id = t.tbl_id
where d.name='tmp_work_db'
group by  d.name ,t.tbl_name
order by  d.name,t.tbl_name 

Comments

  1. As the growth of Big data modernization solutions , it is essential to spread knowledge in people. This meetup will work as a burst of awareness.

    ReplyDelete

Post a Comment

Popular posts from this blog

Installing Hadoop ecosystim in pseudo mode in UBUNTU 12.04 LTS

Changes Done in UBUNTU 12.04 64-bit : Post Installation 1. Access To Root:     eagroup@BI-Lab:~$ sudo su     [sudo] password for eagroup:     root@BI-Lab:/home/eagroup# sudo passwd     Enter new UNIX password: password     Retype new UNIX password: password     passwd: password updated successfully     root@BI-Lab:/home/eagroup# 2.  Add and manage users and groups:     a. Add user from GUI - hduser,     Username     Password    Privilage     root        password    root     eagroup        password    admin     hduser        hduser        hadoop user 3. Making hduser sudoer:     a. login as root   ...

Free easy Twitter sentiment analysis using R console (r-studio)in ubuntu(linux)

Twitter sentiment analysis using r-studio (r console) in ubuntu 1)  login as user su 2) Download  all files from following link: https://drive.google.com/folderview?id=0B1WeP8XHW0OzcEY2TEtwMlZDTmc&usp=sharing#list keep these files in /home/hduser/sentiment ( sample path) positive-words.txt negative-words.txt sentiment.r 3) pre-requisites open  /etc/apt/sources.list and add deb http://<my.favorite.cran.mirror>/bin/linux/ubuntu raring/ sudo apt-get install r-base -- now we have R Console in ubuntu. $ cd /home/hduser/sentiment/ call "R" from command prompt $ R -- Sett working directory(wd) and libraries required for analysis. setwd("/home/hduser/sentiment") install.packages('twitteR') install.packages("ROAuth") install.packages("RCurl") install.packages("plyr") install.packages("stringr") --  it's not required since we have this file. if u want u can download it  b...