|NO.Z.00024|——————————|BigDataEnd|——|Hadoop&Hive.V24|——|Hive.v24|Hive存储机制之行列存储及TextFile.v02|

一、文件存储格式对比测试
### --- 说明:

~~~     给 linux123 分配合适的资源。2core;2048G内存
~~~     适当减小文件的数据量(现有数据约800W,根据自己的实际选择处理100-300W条数据均可)
~~~     # 压缩的资源位置
[root@linux123 ~]# hdfs dfs -ls /user/hive/warehouse/mydb.db/uaction*

~~~     # 检查文件行数
[root@linux123 ~]# wc -l uaction.dat
[root@linux123 ~]# head -n 1000000 uaction.dat > uaction1.dat
[root@linux123 ~]# tail -n 1000000 uaction.dat > uaction2.dat
### --- 文件压缩比

[root@linux123 ~]# hdfs dfs -ls /user/hive/warehouse/mydb.db/uaction*
 
# ORC
    40638630    /user/hive/warehouse/mydb.db/uaction_orc/000000_0
    40638631    /user/hive/warehouse/mydb.db/uaction_orc/000001_0
 
# Parquet
    40638630    /user/hive/warehouse/mydb.db/uaction_parquet/000000_0
    40638631    /user/hive/warehouse/mydb.db/uaction_parquet/000001_0
 
# TextFile
    355573332  /user/hive/warehouse/mydb.db/uaction_text/useraction.dat
### --- ORC > Parquet > text
~~~     执行查询

0: jdbc:hive2://linux123:10000> SELECT COUNT(*) FROM uaction_text;
0: jdbc:hive2://linux123:10000> SELECT COUNT(*) FROM uaction_orc;
0: jdbc:hive2://linux123:10000> SELECT COUNT(*) FROM uaction_parquet;
-- text : 14.446
-- orc: 0.15
-- parquet : 0.146
### --- orc 与 parquet类似 > txt

~~~     在生产环境中,Hive表的数据格式使用最多的有三种:TextFile、ORCFile、Parquet。
~~~     TextFile文件更多的是作为跳板来使用(即方便将数据转为其他格式)
~~~     有update、delete和事务性操作的需求,通常选择ORCFile
~~~     没有事务性要求,希望支持Impala、Spark,建议选择Parquet

 
 
 
 
 
 
 
 
 

Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
                                                                                                                                                   ——W.S.Landor

 

posted on   yanqi_vip  阅读(20)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示