002.phoenix-添加表的索引,并激活索引

 

 

 

复制代码
查看是否走索引
explain select id,tenant_id  ,orderid,localorderid,item_code  ,item_name  ,weight,quantity,price,total,sku_id,discountprice,payamount  from  ORDER_CENTER.TR_ORDER_ITEM where TENANT_ID='1323998749169585185'  and orderid in ( '1333369613318286427' ) ;


创建索引
1、建全局索引(异步)
--在phoenix数据库执行:
create index IDX_ORDERITEM_ORDERID_02 on ORDER_CENTER.TR_ORDER_ITEM (TENANT_ID,ORDERID,ID,LOCALORDERID,ITEM_TYPE,ITEM_ID,ITEM_CODE,ITEM_NAME,SKU_ID,CATEGORYID,QUANTITY,WEIGHT,PRICE,TOTAL,CREATEDTIME,PAYAMOUNT) async;
2、激活索引(异步)
--在命令行执行:
./hbase org.apache.phoenix.mapreduce.index.IndexTool --schema ORDER_CENTER  --data-table  TR_ORDER_ITEM --index-table IDX_ORDERITEM_ORDERID_01 --output-path IDX_ORDERITEM_ORDERID_01

字段显示完整的列
!set maxwidth 3000

查看所有的表 
!tables

查看表详情 
 !desc  tablename
复制代码

 [root@boss  bin]# su hdfs
[hdfs@boss  bin]$ pwd
/usr/hdp/2.6.5.0-292/hbase/bin
[hdfs@boss  bin]$ ./hbase org.apache.phoenix.mapreduce.index.IndexTool --schema ORDER_CENTER  --data-table  TR_ORDER --index-table IDX_ORDER_ORDERID_SHOPCODE --output-path IDX_ORDER_ORDERID_SHOPCODE

posted @   star521  阅读(119)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 记一次.NET内存居高不下排查解决与启示
点击右上角即可分享
微信分享提示