DB2分区表如何区分索引是分区索引还是非分区索引
问题描述 : 经常有人问,我分区表里的索引到底是分区索引还是非分区索引? 因为是否是分区索引涉及到detach分区的时候是否会耗费大量的时间做异步索引清理:如果是非分区索引,则异步索引清理需要大量时间。 总体结论 : --对于唯一索引或者主健,如果包含了分区健,则默认是分区索引;如果不包含分区健,则默认是非分区索引。 --对于非唯一索引,默认都是分区索引。 测试过程 DB2版本为10.5 $ db2 "create table p1 (col1 int not null, col2 int not null, col3 int not null) partition by range(col2)(partition part1 starting 1 ending 5, partition part2 starting 6 ending 10, partition part3 starting 11 ending 15)" 1. 唯一索引 $ db2 "create unique index u_idx1 on p1 (col1)" $ db2 "create unique index u_idx1_2 on p1 (col1,col2)" $ db2 "create unique index u_idx1_3 on p1 (col1,col3)" $ db2look -d