HIVE中ORC表的压缩比较

ORC支持三种压缩:ZLIB,SNAPPY,NONE。最后一种就是不压缩,orc默认采用的是ZLIB压缩。

1.创建一个不压缩的ORC存储方式表

create table test_orc_none (
track_time string,
url string,
ip string
)
row format delimited fields terminated by '\t'
stored as orc tblproperties("orc.compress"="NONE") ;
insert into table test_orc_none select * from test_text ;

查看表的数据量大小:

hdfs -du -h /user/hive/warehouse/test_orc_none;

| 7.7 M  /user/hive/warehouse/test_orc_none/000000_0  |

2.创建一个snappy压缩的ORC存储方式表

create table test_orc_snappy (
track_time string,
url string,
ip string
)
row format delimited fields terminated by '\t'
stored as orc tblproperties("orc.compress"="SNAPPY") ;
insert into table test_orc_snappy select * from test_text ;

查看表的数据量大小:

hdfs -du -h /user/hive/warehouse/test_orc_snappy;

| 3.8 M  /user/hive/warehouse/test_orc_snappy/000000_0  |

3.创建一个ZLIB压缩的ORC存储方式表(默认方式)

  • 不指定压缩格式的就是默认的采用ZLIB压缩
    • 可以参考上面创建的 test_orc 表

查看表的数据量大小:

hdfs -du -h /user/hive/warehouse/test_orc;

| 2.8 M  /user/hive/warehouse/test_orc/000000_0  |

4.存储方式和压缩总结

  • orc 默认的压缩方式ZLIB比Snappy压缩的还小。
  • 在实际的项目开发当中,hive表的数据存储格式一般选择:orc或parquet。
  • 由于snappy的压缩和解压缩 效率都比较高,压缩方式一般选择snappy。

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值