MapReduce服务 MRS-REGISTER INDEX TABLE:示例

时间:2023-11-01 16:25:29

示例

create database productdb;

use productdb;

CREATE TABLE productSalesTable(a int,b string,c string) stored as carbondata;

create index productNameIndexTable on table productSalesTable(c) as 'carbondata';

insert into table productSalesTable select 1,'a','aaa';

create database productdb2;

使用hdfs命令将productdb数据库下的productSalesTable和productNameIndexTable 拷贝到productdb2。

refresh table productdb2.productSalesTable ;

refresh table productdb2.productNameIndexTable ;

explain select * from productdb2.productSalesTable where c = 'aaa'; //可以发现该查询命令没有使用索引表

REGISTER INDEX TABLE productNameIndexTable ON productdb2.productSalesTable;

explain select * from productdb2.productSalesTable where c = 'aaa'; //可以发现该查询命令使用了索引表

support.huaweicloud.com/cmpntguide-mrs/mrs_01_1435.html