对旧表进行分区
例: 对 cgds2016..st_dd_custasset 进行分区:
1,执行分区函数:
proc_tbparttion ‘cgds2016’ ,’st_dd_custasset_h’ , ‘20160101’,’20180101’
注:20160101 20180101分区已提前创建好,不可更改。
2,结束后会自动生成
分区函数:pf_st_dd_custasset_h
分区方案:ps_st_dd_custasset_h
3,如需重新来过,执行删除操作:
drop partition function pf_st_dd_custasset_h
drop schema ps_st_dd_custasset_h
4,通过创建分区索引关联分区
create nonclustered index ix_st_dd_custasset_h
on st_dd_custasset_h (id)
on ps_st_dd_custasset_h (dcdate)
对新表进行分区
1, 创建分区函数,分区方案
proc_tbparttion ‘cgds2016’ ,’st_dd_custasset_h’ , ‘20160101’,’20180101’
2,
create table st_dd_custasset_h
( dcdate int
,id bigint
,account_type int
,cls varchar(32)
,cls_name varchar(32)
)on ps_st_dd_custasaset_h(dcdate)
2, 可对custid添加非聚集索引
create nonclustered index ix_st_dd_custasset_h
on st_dd_custasset_h (id)
on ps_ st_dd_custasset_h (dcdate)