Informix 可以提供索引禁用的功能,通过测试结果如下:
1、在禁用期间,dbschema查看表结构的时候,索引已经是disabled的状态,oncheck -pt看不到磁盘上的索引extent信息;
set indexes idx_name disabled;
2、在索引禁用期间,继续插入新数据,然后再启用索引,可以观察到新插入数据对应的索引的extent已经生成。
set indexes idx_name enabled;
1、customer2表有uniq index,插入100W行数据;
RESERVED PAGES 0 2
CHUNK FREELIST PAGE 2 1
tpcc100:'informix'.idx_omer2 3 9845
tpcc100:'benchmarksql'.customer2 9848 65536
tpcc100:'informix'.idx_omer2 75384 1408
tpcc100:'benchmarksql'.customer2 76792 65536
FREE 142328 369672
2、set indexes idx_omer2 disabled;
RESERVED PAGES 0 2
CHUNK FREELIST PAGE 2 1
FREE 3 9845
tpcc100:'benchmarksql'.customer2 9848 65536
FREE 75384 1408
tpcc100:'benchmarksql'.customer2 76792 196608
FREE 273400 238600
3、set indexes idx_omer2 enabled;
RESERVED PAGES 0 2
CHUNK FREELIST PAGE 2 1
tpcc100:'informix'.idx_omer2 3 9845
tpcc100:'benchmarksql'.customer2 9848 65536
tpcc100:'informix'.idx_omer2 75384 1408
tpcc100:'benchmarksql'.customer2 76792 196608
tpcc100:'informix'.idx_omer2 273400 1408
FREE 274808 237192
4、drop index idx_omer2;
RESERVED PAGES 0 2
CHUNK FREELIST PAGE 2 1
FREE 3 9845
tpcc100:'benchmarksql'.customer2 9848 65536
FREE 75384 1408
tpcc100:'benchmarksql'.customer2 76792 196608
FREE 273400 238600
5、create unique index idx_omer2;
RESERVED PAGES 0 2
CHUNK FREELIST PAGE 2 1
tpcc100:'informix'.idx_omer2 3 9845
tpcc100:'benchmarksql'.customer2 9848 65536
tpcc100:'informix'.idx_omer2 75384 1408
tpcc100:'benchmarksql'.customer2 76792 196608
tpcc100:'informix'.idx_omer2 273400 1408
FREE 274808 237192