ITPub博客

首页 > 数据库 > 数据库开发技术 > informix fragment 分片表的常见操作 ids9.40

informix fragment 分片表的常见操作 ids9.40

原创 数据库开发技术 作者:polestar123 时间:2009-12-04 17:07:46 0 删除 编辑
1、创建分片表
create table cell_fragment
(
id int,
name varchar(10)
)
FRAGMENT by EXPRESSION
(id > 5 and id < 10) IN niosdbs,
(id <= 5) IN tpddbs;

2、生成测试数据
insert into cell_fragment values(1,'1111');
insert into cell_fragment values(4,'44');
insert into cell_fragment values(8,'81111');
insert into cell_fragment values(9,'91111');
insert into cell_fragment values(2,'21111');
insert into cell_fragment values(3,'31111');
insert into cell_fragment values(10,'31111');
insert into cell_fragment values(16,'31111');
insert into cell_fragment values(19,'31111');

3、查询系统表,定位tabid
select * from systables where tabname ='cell_fragment'
select * from SYSFRAGMENTS where tabid = 1539

4、每次操作后更新统计信息
update statistics high for table cell_fragment
5、add detach attach modify init更改分片
alter fragment on table cell_fragment add (id >=10 and id <20) in nrmdbs;
alter fragment on table cell_fragment detach nrmdbs temp_nrmdbs;
alter fragment on table cell_fragment attach temp_nrmdbs as (id >=10 and id <20);
alter fragment on table cell_fragment add remainder in kpidbs;
alter fragment on table cell_fragment modify kpidbs01 to (id <3) in tpddbs;
alter fragment on table cell_fragment init fragment by expression
id <3 in nrmdbs,
id >=3 and id <5 in niosdbs,
id >=5 and id <10 in kpidbs,
remainder in tpddbs;
select * from temp_nrmdbs;
alter table cell_fragment add CONSTRAINT primary key(id);

总结
1、ids9.4尚不支持 partition by expression partition part1 (id > 5 and id < 10) IN niosdbs类似的操作;ids11已经提供了支持
2、partition part1 in dbs01,partion part2 in dbs03,partition part3 in dbs01,partition part4 in dbs04;就是说每个partition要有每个具体的名称,如果没有具体的名

称的话,分片的名称就是所在dbspace的名称。默认情况下每个分片所在不同的dbspace,如果多个分片在一个dbspace中要给每个分片起不同的名字。
[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70612/viewspace-1029359/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-05-22

  • 博文量
    110
  • 访问量
    438364