SqlServer分区过程:
1、创建文件组
alter database testdb add filegroup [filegroup1]
2、创建文件组文件
alter database testdb add file (name=N‘file1‘, filename=N‘C:\db\data\file1.ndf‘, size=5MB, filegrowth=5MB) to filegroup [filegroup1]
3、创建分区函数
create partition function [func_order](orderId) as range left for values(0, 1000, 2000)
4、创建分区方案
create partition scheme [schema_order] as partition [func_order] to ([PRIMARY], [filegroup1])
5、在分区方案下创建表
create table [dbo].[order]( [orderId] bigint not null, [quantity] int ) on schema_order(orderId)
6、在分区方案下创建索引
CREATE CLUSTERED INDEX [ClusteredIndex_on_schema_order] ON [dbo].[order] ( [orderId] )WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [func_order]([orderId])
时间: 2024-10-05 02:18:52