Friday, October 5, 2007

SPLIT RANGE

Based on boundary_value, the Microsoft SQL Server 2005 Database Engine splits one of the existing ranges into two. Of these two, the one where the new boundary_value resides is considered the new partition.
Assuming you have created databases and its filegroups: FG1 and FG2;


CREATE PARTITION FUNCTION pf(int) AS RANGE LEFT FOR VALUES(6)
CREATE PARTITION SCHEME [ps] AS PARTITION [pf] TO ([FG1], [FG2])


RANGE LEFT means that partition1<=6 and partition2 >6.

CREATE two more filegroups to your database: FG3 and FG4


ALTER PARTITION SCHEME ps NEXT USED [FG3]
GO
ALTER PARTITION FUNCTION pf() SPLIT RANGE(20)
GO

Check the Partition Scheme definition by scripting it to a new query window; you will have the following:
CREATE PARTITION SCHEME [ps] AS PARTITION [pf] TO ([FG1], [FG3], [FG2])

ALTER PARTITION SCHEME ps NEXT USED [FG4]
GO
ALTER PARTITION FUNCTION pf() SPLIT RANGE(2)

GO
Check the Partition Scheme definition by scripting it to a new query window; you will have the following:

CREATE PARTITION SCHEME [ps] AS PARTITION [pf] TO ([FG4], [FG1], [FG3], [FG2])


MAP







For the same boundary value, if the partition function is RANGE RIGHT, you will have the following scheme map: