hive 索引

来源:互联网 发布:mysql数据库名称查询 编辑:程序博客网 时间:2024/05/18 02:15
设置索引:
hive> set hive.optimize.index.groupby=false;
hive> set hive.optimize.index.filter=true;                      


注意 hive.optimize.index.groupby必须设置生false,不然 hive.optimize.index.filter不起作用。


hive> explain select count(1) from ctest where dp_id='10275499';

STAGE PLANS:  Stage: Stage-3    Map Reduce      Alias -> Map Operator Tree:        taobao_db__aatest_aatestindex__           TableScan            alias: taobao_db__aatest_aatestindex__            filterExpr:                expr: (tid = '57301233')                type: boolean            Filter Operator
可以发现会执行索引。


然而:

不使用索引cpu耗时:

Total MapReduce CPU Time Spent: 1 minutes 45 seconds 300 msec
使用索引cpu耗时:

Total MapReduce CPU Time Spent: 5 minutes 2 seconds 250 msec
让人很费解,使用索引后性能上没有得到提升。