Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

database - How to calculate size of the one record in hive?

I need to understand how much memory my table will use. I know the arithmetic mean of records. I know what types of records have. But I can't understand how to calculate mean/max size of the record. Is this possible to calculate it if I get mean/max size of every column of record?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

get mean/max size of every column

Also you can analyze table and fetch stats for column.

Analyze table:

ANALYZE TABLE tablename COMPUTE STATISTICS FOR COLUMNS;

Use DESCRIBE FORMATTED:

desc formatted  tablename  column_name

It will print these figures:

data_type, min, max, num_nulls, distinct_count, avg_col_len, max_col_len, num_trues, num_falses

Unfortunately, it works for single column at a time and you need to repeat describe command to get all columns stats.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...