hive索引简单使用介绍
来源:互联网 发布:linux人 编辑:程序博客网 时间:2024/05/19 23:55
索引是标准的数据库技术,hive 0.7版本之后支持索引。hive索引采用的不是'one size fites all'的索引实现方式,而是提供插入式接口,并且提供一个具体的索引实现作为参考。
hive索引具有以下特点:
1.索引key冗余存储,提供基于key的数据视图
2.存储设计以优化查询&检索性能
3.对于某些查询减少IO,从而提高性能。
hive索引创建语句:
注意:
1.index的partition默认和数据表一致
2.视图上不能创建index
3. index可以通过stored as配置存储格式
重建索引:
假如在创建索引是我们使用“ WITH DEFERRED REBUILD”语句,则索引创建是为空,可以通过“Alter index ... REBUILD”在一个partition上或所有partition上构建索引。
注意:
1.当hive数据更新时,必须调用该语句更新索引。
2. index rebuild操作时一个原子操作,因此,当rebuild失败时,先前构建的索引也无法使用
删除索引:
示例:
创建表&索引
查看索引数据:
$ hadoop fs -ls /user/hive/warehouse/default__index_test_index1_index_test__
Found 3 items
drwxr-xr-x - work supergroup 0 2012-08-16 18:27 /user/hive/warehouse/default__index_test_index1_index_test__/dt=2012-08-10
drwxr-xr-x - work supergroup 0 2012-08-16 18:27 /user/hive/warehouse/default__index_test_index1_index_test__/dt=2012-08-11
drwxr-xr-x - work supergroup 0 2012-08-16 18:28 /user/hive/warehouse/default__index_test_index1_index_test__/dt=2012-08-12
$ hadoop fs -cat /user/hive/warehouse/default__index_test_index1_index_test__/dt=2012-08-10/000000_0
5,hdfs://localhost:9000/user/hive/warehouse/index_test/dt=2012-08-10/000000_0,0
6,hdfs://localhost:9000/user/hive/warehouse/index_test/dt=2012-08-10/000000_0,10
7,hdfs://localhost:9000/user/hive/warehouse/index_test/dt=2012-08-10/000000_0,20
删除索引:
索引数据也被删除
$ hadoop fs -ls /user/hive/warehouse/default__index_test_index1_index_test__
ls: Cannot access /user/hive/warehouse/default__index_test_index1_index_test__: No such file or directory.
reference:
Hive IndexDev
Hive Index
hive索引具有以下特点:
1.索引key冗余存储,提供基于key的数据视图
2.存储设计以优化查询&检索性能
3.对于某些查询减少IO,从而提高性能。
hive索引创建语句:
注意:
1.index的partition默认和数据表一致
2.视图上不能创建index
3. index可以通过stored as配置存储格式
重建索引:
假如在创建索引是我们使用“ WITH DEFERRED REBUILD”语句,则索引创建是为空,可以通过“Alter index ... REBUILD”在一个partition上或所有partition上构建索引。
注意:
1.当hive数据更新时,必须调用该语句更新索引。
2. index rebuild操作时一个原子操作,因此,当rebuild失败时,先前构建的索引也无法使用
删除索引:
示例:
创建表&索引
查看索引数据:
$ hadoop fs -ls /user/hive/warehouse/default__index_test_index1_index_test__
Found 3 items
drwxr-xr-x - work supergroup 0 2012-08-16 18:27 /user/hive/warehouse/default__index_test_index1_index_test__/dt=2012-08-10
drwxr-xr-x - work supergroup 0 2012-08-16 18:27 /user/hive/warehouse/default__index_test_index1_index_test__/dt=2012-08-11
drwxr-xr-x - work supergroup 0 2012-08-16 18:28 /user/hive/warehouse/default__index_test_index1_index_test__/dt=2012-08-12
$ hadoop fs -cat /user/hive/warehouse/default__index_test_index1_index_test__/dt=2012-08-10/000000_0
5,hdfs://localhost:9000/user/hive/warehouse/index_test/dt=2012-08-10/000000_0,0
6,hdfs://localhost:9000/user/hive/warehouse/index_test/dt=2012-08-10/000000_0,10
7,hdfs://localhost:9000/user/hive/warehouse/index_test/dt=2012-08-10/000000_0,20
删除索引:
索引数据也被删除
$ hadoop fs -ls /user/hive/warehouse/default__index_test_index1_index_test__
ls: Cannot access /user/hive/warehouse/default__index_test_index1_index_test__: No such file or directory.
reference:
Hive IndexDev
Hive Index
阅读全文
0 0
- hive索引简单使用介绍
- hive视图和索引的简单介绍
- Hive索引使用
- HIVE的简单介绍
- Hive简单介绍
- Hive 简单介绍
- 索引简单介绍
- 空间索引使用的意义及网格索引和四叉树索引简单介绍
- hive中简单介绍分区表
- hive 中简单介绍分区表
- hive中简单介绍分区表
- hive中简单介绍分区表
- hive中简单介绍分区表
- hive中简单介绍分区表
- 使用Oracle函数索引简单介绍(一般)
- 简单介绍SQL Server中索引使用及维护
- HIVE简单API使用
- 索引介绍和使用
- map按key和按value排序
- Oracle EBS解决There are no active responsibilities available for this user(不存在适用于此用户的有效责任)
- Elasticsearch Java API 的使用(7)—多条件查询
- Spring入门
- ug nx8.0免费版下载 含64位/32位
- hive索引简单使用介绍
- jQuery的环境搭建
- windows远程服务器 上部署javaweb项目
- 【状压dp && 矩阵快速幂】 POJ
- Codeforces 851A && Round #432 Div. 2 A. Arpa and a research in Mexic
- Elasticsearch Java API 的使用(8)—Scroll (游标)API详解
- UNIX环境编程学习笔记(22)——进程管理之system 函数执行命令行字符串
- Excel操作笔记--联动下拉菜单
- Elasticsearch Java API 的使用(9)—Bulk大数据量的批量上传