• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
导航菜单
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • windows
  • 服务器硬件
  • 服务器运维
  • 云计算
  • 虚拟化
  • IIS教程
  • Linux
  • Apache
  • Ftp
  • DNS
  • Nginx
您的位置:首页 > 服务器 >云计算 > hive schema详解,hiveschema

hive schema详解,hiveschema

作者:网友 字体:[增加 减小] 来源:互联网

本文主要包含hive schema,schema,schema是什么意思,information schema,xml schema等服务器相关知识,网友希望可以进行参考

hive schema详解,hiveschema


schema设计 hive pattern && hiveanti-pattern
1.Table by day 按照天分割数据,在relation中,这个参数不推荐,在hive中使用
create table supply(id int,partstring,quantity int) partitioned by (int day)
alter table supply add partition(day=20120102)
partition的负面影响:
1.namenode limition
但是partition产生的子目录,子文件都会保存在hdfs中,namenode会存在内存中,所以这得负面效果是namenode的filesystem的容量上限(hadoop has this upper limit on the total number of file,mapr andamazon s3 don't have this limitation)
2.一个job分解成几个task,每个task是一个jvm实例,每一个file对应一个独立的task,每个task是jvm中独立的一个实例(进程),过多的实例会给jvm压力(start up and tear down),这使得计算速度降低
因此不能有太多partition,每个文件要尽可能的大
一个好的table by day的设计,是设计出相似大小的数据在不同的时间间断,时间间断可以适当增大。同时保证每个file大于filesystem block size。目的是让partition足够的大。另一种方法,是用多维度的partition分解数据。
2.unique keys and normalization 主键,格式化数据
关系数据库最爱用地策略,但是在hive中没有这种概念。因为hive可以存储denormalized data非格式化的数据,如array,map,struct。这样可以避免one-to-many的关联关系,加快了io速度。但是也pay the penalty of denormalization,比如数据复制,数据不一致的概率
3.making multiple passes over the same data 同数据源的操作优化
insert overwrite table sales
select * from history whereaction='purchased';
insert overwrite table credits
select * from history where action='returned';
from history
insert overwrite sales select *where action='purchased'
insert overwrite credits select *where action = 'returned'
4.the case for partitioning every table
为了避免job fail而使得数据被删除,在insert数据的时候可以使用table pardae table1partition(day=20120102).但是需要删除这个中间换转者partition
5.bucketing table data storage
当table没有明显的partition特征时,或是减轻filesystem的负担,可以使用bucketing,他的优点是不会随着增加数据使得文件个数变动,而且对于取样sample是很容易的,对于一些joins操作也比较便利。
create table weblog(user_idint,url string,source_ip string) partition by (dt string) clustered by(user_id) into 96 buckets;
为了生成正确个数的reducer对应hash出得bucket
在查询的时候设置 sethive.enforce.bucketing=true;
from raw_logs或是设置reduce数直接等于bucket数set mapred.reduce.tasks=96
insert overwrite table weblogpartition(dt='2009-02-25') select user_id,url,source_ip where dt='2009-02-25'
6.adding colums to a table
hive是没有格式化的数据仓库,随着数据需求可以增加一列,数据少于期待列数,则填补null,数据多于,则舍弃。
create table weblogs(versionlong,url string) partitioned by (hit_data int) row format delimited fieldsterminated by '\t'
加载数据,可以用int补上缺少的数据
load data local inpath 'log1.txt'int weblogs partition(20110101)
7.(almost)always use compression

分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • hive schema详解,hiveschema

相关文章

  • storm的集群安装与配置,storm集群配置
  • linux screen 使用方法,linuxscreen
  • openstack 用nova API 指定 compute node 创建 instance,openstackcompute
  • Web.xml配置详解,web.xml详解
  • Apache Spark的设计思路,apachespark
  • apache hive 0.14 beeline 使用注意事项,hivebeeline
  • Neutron数据库同步错误 NotImplementedError: No support for ALTER of constraints in SQLite dialect,sqlitealtertable
  • error: internal error: unable to execute QEMU command 'migrate': this feature or command is not cur,qemumigrate
  • 微软小冰、小娜不久相会在中国,微软相会在中国
  • 【Spark1.3官方翻译】Spark集群模式概览,spark1.3spark

文章分类

  • windows
  • 服务器硬件
  • 服务器运维
  • 云计算
  • 虚拟化
  • IIS教程
  • Linux
  • Apache
  • Ftp
  • DNS
  • Nginx

最近更新的内容

    • python模块,python
    • UCB CS162: Get sarted, create a docker container for UCB CS162 online course,ucbcs162
    • 什么是Code Review,CodeReview
    • hadoop2.6.0伪分布式安装,hadoop2.6.0伪
    • Flocker浅析与Docker插件(3),flockerdocker
    • Hbase namespace问题,hbasenamespace问题
    • Spark 基于item和user 的协同过滤实现,sparkitem
    • 现代数学的引路人,现代数学引路人
    • Nova client源码分析---nova list命令,nova---nova
    • Hive编程指南_学习笔记01,hive编程指南

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有