Data Units

In the order of granularity - Hive data is organized into:

数据库、表、分区、桶

  • Databases: Namespaces that separate tables and other data units from naming confliction.
  • Tables: Homogeneous units of data which have the same schema. An example of a table could be page_views table, where each row could comprise of the following columns (schema):
    • timestamp - which is of INT type that corresponds to a unix timestamp of when the page was viewed.
    • userid - which is of BIGINT type that identifies the user who viewed the page.
    • page_url - which is of STRING type that captures the location of the page.
    • referer_url - which is of STRING that captures the location of the page from where the user arrived at the current page.
    • IP - which is of STRING type that captures the IP address from where the page request was made.
  • Partitions: Each Table can have one or more partition Keys which determines how the data is stored. Partitions - apart from being storage units - also allow the user to efficiently identify the rows that satisfy a certain criteria. For example, a date_partition of type STRING and country_partition of type STRING. Each unique value of the partition keys defines a partition of the Table. For example all "US" data from "2009-12-23" is a partition of the page_views table. Therefore, if you run analysis on only the "US" data for 2009-12-23, you can run that query only on the relevant partition of the table thereby speeding up the analysis significantly. Note however, that just because a partition is named 2009-12-23 does not mean that it contains all or only data from that date; partitions are named after dates for convenience but it is the user's job to guarantee the relationship between partition name and data content!). Partition columns are virtual columns, they are not part of the data itself but are derived on load.(分区列是虚拟列,他们不是数据本身的一部分,是在执行load时候加载的得到的)
  • Buckets (or Clusters): Data in each partition may in turn be divided into Buckets based on the value of a hash function of some column of the Table. For example the page_views table may be bucketed by userid, which is one of the columns, other than the partitions columns, of the page_view table. These can be used to efficiently sample the data. 表中的具有的数据列(非分区列),可以基于数据值的Hash方法切分成桶中。如此,可以高效的取样数据。

Note that it is not necessary for tables to be partitioned or bucketed, but these abstractions allow the system to prune large quantities of data during query processing, resulting in faster query execution.表的分区和桶,并不一定是必须,但是这种抽象可以使得系统在进行数据查询,结果集返回时候减少数据的量,提高执行效率。

[Hive - Tutorial] Data Units 数据存储单位的更多相关文章

  1. Pb (数据存储单位)

    PB (数据存储单位) 编辑 pb指petabyte,它是较高级的存储单位,其上还有EB,ZB,YB等单位. 它等于1,125,899,906,842,624(2的50次方)字节,“大约”是一千个te ...

  2. hive基本结构与数据存储

    一.Hive简介 Hive是基于Hadoop的一个数据仓库工具,可以将结构化的数据文件映射为一张数据库表,并提供类SQL查询功能.还可以将 SQL 语句转换为 MapReduce 任务进行运行,通过自 ...

  3. 数据存储单位的换算关系(TB、PB、EB、ZB、YB)

  4. centos 7.1系统更改Mariadb数据存储位置步骤分享

    一.首先确保你要更改Mariadb数据存储的位置的空间够大 现在已将Mariadb存储位置更改到/opt/目录下 1.然后将Mariadb服务stop:systemctl stop mariadb 2 ...

  5. Hive_Hive的数据模型_数据存储

    Hive的数据模型_数据存储 web管理工具察看HDFS文件系统:http://<IP>:50070/ 基于HDFS没有专门的数据存储格式,默认使用制表符存储结构主要包括:数据库,文件,表 ...

  6. 一文彻底搞懂Hive的数据存储与压缩

    目录 行存储与列存储 行存储的特点 列存储的特点 常见的数据格式 TextFile SequenceFile RCfile ORCfile 格式 数据访问 Parquet 测试 准备测试数据 存储空间 ...

  7. hadoop笔记之Hive的数据存储(分区表)

    Hive的数据存储(分区表) Hive的数据存储(分区表) 分区表 Partition对应于数据库的Partition列的密集索引 在Hive中,表中的一个Partition对应于表下的一个目录,所有 ...

  8. Hive之 数据存储

    首先,Hive 没有专门的数据存储格式,也没有为数据建立索引,用户可以非常自由的组织 Hive 中的表,只需要在创建表的时候告诉 Hive 数据中的列分隔符和行分隔符,Hive 就可以解析数据. 其次 ...

  9. Hive数据导入——数据存储在Hadoop分布式文件系统中,往Hive表里面导入数据只是简单的将数据移动到表所在的目录中!

    转自:http://blog.csdn.net/lifuxiangcaohui/article/details/40588929 Hive是基于Hadoop分布式文件系统的,它的数据存储在Hadoop ...

随机推荐

  1. MVVM 代码记录

      一.XML <Page x:Class="MVVM.MainPage" xmlns="http://schemas.microsoft.com/winfx/20 ...

  2. jQuery编程基础精华02(属性、表单过滤器,元素的each,表单选择器,子元素过滤器(*),追加方法,节点,样式操作)

    属性.表单过滤器 属性过滤选择器: $("div[id]")选取有id属性的<div> $("div[title=test]")选取title属性为 ...

  3. 1、Web容器的理解&Tomcat的安装与配置

    Web容器的理解 <Java Web开发实战经典——基础篇>一书中对Web容器这一概念阐述得很好,借用其观点对Web容器加以理解: 想要运行一个Java Web的程序,则必须有相应的Web ...

  4. BeanFactory 和 ApplicationContext

    Spring通过一个配置文件描述Bean及Bean直接的依赖关系,利用Java语言的反射功能实例化Bean并建立Bean之间的依赖关系.Sprig的IoC容器在完成这些底层工作的基础上,还提供了Bea ...

  5. maven小项目注册服务(二)--captcha模块

    验证码生成模块,配置信息基本和前面的模块一样.account-captcha需要提供的服务是生成随机的验证码主键,然后用户可以使用这个主键要求服务生成一个验证码图片,这个图片对应的值应该是随机的,最后 ...

  6. 用代码编辑数据库T-SQL语句

    1.创建表 create table Car( Code varchar(50) primary key, Name varchar(50), Time date, Price float, Bran ...

  7. mysql备份恢复数据库据/表

    备份单个数据库,只备份表,如要恢复,必须先创建一个数据库[root@s]# mysqldump -u root -p dbname1 > dbname1.sql[root@s]# mysql - ...

  8. csv 文件介绍

    CSV即Comma Separate Values,这种文件格式经常用来作为不同程序之间的数据交互的格式. 具体文件格式 每条记录占一行 以逗号为分隔符 逗号前后的空格会被忽略 字段中包含有逗号,该字 ...

  9. sdut 2819 比赛排名(边表 拓扑排序)

    题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2819 #include <iost ...

  10. EASYUI+MVC4通用权限管理平台

    通用权限案例平台在经过几年的实际项目使用,并取得了不错的用户好评.在平台开发完成后,特抽空总结一下平台知识,请各位在以后的时间里,关注博客的更新. 1.EASYUI+MVC4通用权限管理平台--前言 ...