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

Categories

0 votes
953 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...