软件环境:

linux系统: CentOS6.7
Hadoop版本: 2.6.5
zookeeper版本: 3.4.8

##主机配置:
#####一共m1, m2, m3这三部机, 每部主机的用户名都为centos
```
192.168.179.201: m1
192.168.179.202: m2
192.168.179.203: m3

m1: Zookeeper, Namenode, DataNode, ResourceManager, NodeManager, Master, Worker

m2: Zookeeper, Namenode, DataNode, ResourceManager, NodeManager, Worker

m3: Zookeeper, DataNode, NodeManager, Worker



####资料

官方资料:

https://cwiki.apache.org/confluence/display/Hive/IndexDev

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-Create/Drop/AlterIndex



---
<br>
<br>
####一. 编辑hive-site.xml文件

hive.optimize.index.filter
true

hive.optimize.index.groupby
true

hive.index.compact.file.ignore.hdfs
true

```










####二. 创建Hive表索引
```
官方资料:
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Indexing
```


1.创建/构造, 显示, 删除索引:

create index table01_index on table table01 (column2) as 'compact';
show index on table01;
drop index table01_index on table01;

2.创建时重构, 格式化显示 (with column names), 删除索引:

create index table02_index on table table02 (column3) as 'compact' with deferred rebuild;
alter index table02_index on table2 rebuild;
show formatted index on table02;
drop index table02_index on table02;

3.创建索引视图, 构建, 显示, 删除:

create index table03_index on table table03 (column4) as 'bitmap' with deferred rebuild;
alter index table03_index on table03 rebuild;
show formatted index on table03;
drop index table03_index on table03;

4.在新表中创建索引:

create index table04_index on table table04 (column5) as 'compact' with deferred rebuild in table table04_index_table;

5.创建索引以RCFile的存储格式:

create index table05_index on table table05 (column6) as 'compact' stored as RCFile;

6.创建索引以TextFile的存储格式:

create index table06_index on table table06 (column7) as 'compact' row format delimited fields terminated by '\t' stored as textFile;

7.创建索引和索引的属性:

create index table07_index on table table07 (column8) as 'COMPACT' idxproperties ("prop1"="value1", "prop2"="value2");

8.创建索引和表的属性:

create index table08_index on table table08 (column9) as 'compact' tblproperties ("prop3"="value3", "prop4"="value4");

9.索引如果存在则删除:

drop index if exists table09_index on table09;

10.重构一个分区的数据:

alter index table10_index on table10 partition (columnX='valueQ', columnY='valueR') rebuild;

最新文章

  1. .NET组件控件实例编程系列——5.DataGridView数值列和日期列
  2. 关于线上的bug什么时候修复的思考
  3. [原] XAF 如何非常容易禁止清除一个下拉字段的值?
  4. 解决requestAnimationFrame的兼容问题
  5. 编写高质量代码改善C#程序的157个建议
  6. ###STL学习--关联容器
  7. mongodb创建用户和密码
  8. QRadionButton 圆点样式
  9. swift 笔记 (十二) —— 下标
  10. 美团点评2017校招研发offer面经
  11. yii2 源码分析 Component类分析 (二)
  12. android开发技巧——仿新版QQ锁屏下弹窗
  13. JS中简单的二级城市联动
  14. exgcd
  15. 推荐一款在线编辑JSON的网站
  16. shell 命令 if [ -d filename] 判断文件
  17. js 常用事件
  18. js dictionary字典 遍历
  19. mysql group by分组查询
  20. Augmenting DOM Storage with IE&#39;s userData behavior

热门文章

  1. noip模拟赛 捡金币
  2. HUD——1286 找新朋友
  3. - &gt; 最大公约数(辗转相除法)和最小公倍数(公式法)
  4. Spring实现封装自定义注解@Trimmed清除字符串前后的空格
  5. MYSQL利用Navicat对含有Bold字段表进行导入导出
  6. Live555研究之中的一个 源码编译
  7. 并发数 = QPS*平均响应时间
  8. lightbox2
  9. oracle 分页方法
  10. CSS3径向渐变实现优惠券波浪造型