创建和删除索引
最近更新时间: 2025-02-18 16:02:00
创建索引
使用命令create index创建索引
示例:
1)创建唯一索引
create table t_first_col_share(id serial not null,nickname text);
create unique index t_first_col_share_id_uidx on t_first_col_share using btree(id);
⚠️非shard key字段不能建立唯一索引
2)创建多字段索引
create table t_mul_idx (f1 int,f2 int,f3 int,f4 int);
create index t_mul_idx_idx on t_mul_idx(f1,f2,f3);
⚠️or查询条件bitmap scan最多支持两个不同字段条件
删除索引
使用命令DROP INDEX修改索引
drop index t_first_col_share_id_uidx;