hive表常用存储格式和压缩格式

hive表常用的存储格式主要包括:orc、parquet、avro、rcfile、sqeuencefile几种,存储格式一般会选择综合性能最好的orc或者parquet,这两种都是列式存储格式。压缩格式一般会选择snappy、lzo、gizp,针对不同的应用场景使用不同的压缩方式。

1. 压缩方式选择(hive table):

数据量大,计算性能要求不高的业务数据,一般用gzip(压缩比最高,压缩解压缩速度最慢)

计算性能要求较高,数据量不是特别大的业务数据,一般用lzo或者snappy (压缩比没有gzip高,但是压缩解压速度较快)

// snappy:
row format delimited fields terminated by '\t'
stored as orc tblproperties("orc.compress"="SNAPPY");

// lzo:
stored as INPUTFORMAT'com.hadoop.mapred.DeprecatedLzoTextInputFormat'
          OUTPUTFORMAT'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
location '/user/pmp_bi/test/testlog/'

2. 存储方式选择(hive table):

选择综合性能最优的两种存储格式:orc和parquet

hive一般用orc,spark一般用parquet,snappy配合parquet性能最高。

发布了81 篇原创文章 · 获赞 29 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/breakout_alex/article/details/103007718
今日推荐