1.创建索引
(1)先建表,再建索引
create clustered columnstore index index_name on table_name
(2)建表的时候直接建索引
drop table if exists table_name
create table table_name(
---具体字段
index index_name clustered columnstore
)
注:可使用非聚集列索引来对列存储表实施强制主键约束
alter table table_name add constraint 约束名称 unique (主键字段)
(3)将行存储表转为列存储
create clustered columnstore index index_name on table_name with(drop_existing=on)