CREATE INDEX
CREATE INDEX 仅用于创建 Bitmap 索引。有关 Bitmap 索引的使用说明和场景,请参见 Bitmap 索引。
提示
此操作需要目标表的 ALTER 权限。您可以按照 GRANT 中的说明授予此权限。
语法
CREATE INDEX index_name ON table_name (column_name) [USING BITMAP] [COMMENT'']
参数
参数 | 必需 | 描述 |
---|---|---|
index_name | 是 | 索引名称。有关命名约定,请参见系统限制。 |
table_name | 是 | 表的名称。 |
column_name | 是 | 要在其上构建索引的列的名称。一列只能有一个 BITMAP 索引。如果一列已经有一个索引,则无法再在其上创建一个索引。 |
COMMENT | 否 | 索引的注释。 |
示例
创建一个表sales_records
,如下所示
CREATE TABLE sales_records
(
record_id int,
seller_id int,
item_id int
)
DISTRIBUTED BY hash(record_id)
PROPERTIES (
"replication_num" = "3"
);
在sales_records
的item_id
列上创建一个索引index
。
CREATE INDEX index3 ON sales_records (item_id) USING BITMAP COMMENT '';