Database Reference
In-Depth Information
Now let's look at what happens when you have
RANGE RIGHT
partition function with the same boundary values,
as defined in Listing 15-16.
Listing 15-16.
RANGE RIGHT
partition function
create partition function pfRight(int)
as range right for values (10,20);
create partition scheme psRight
as partition pfRight
to ([FG1],[FG2],[FG3])
go
alter partition scheme psRight
next used [FG4];
In a
RANGE RIGHT
partition function, the boundary values represent the lowest value in a partition. When you split
a
RANGE RIGHT
partition, the new partition with the new lowest boundary value is moved to the
NEXT USED
filegroup.
Table
15-3
shows a partition and filegroup layout for the various
SPLIT
operations.
Table 15-3.
RANGE RIGHT
partition function and
SPLIT
operations
FG1
FG2
FG3
FG4
Original
{min..9}
{10..19}
{20..max}
SPLIT RANGE(0)
{min.. -1}
{10..19}
{20..max}
{0..9}
SPLIT RANGE(15)
{min..9}
{10..14}
{20..max}
{15..19}
SPLIT RANGE(30)
{min..9}
{10..19}
{20..29}
{30..max}
Now let's look at a
MERGE
operation and assume that you have partition functions with the boundary values of
(10, 20, 30). For a
RANGE RIGHT
partition function, the data from the right partition is moved to the left partition
filegroup. Table
15-4
illustrates this point.
Table 15-4.
RANGE LEFT
partition function and
MERGE
operations
FG1
FG2
FG3
FG4
Original
{min..10}
{11..20}
{21..30}
{31..max}
MERGE RANGE(10)
{min..20}
{21..30}
{31..max}
MERGE RANGE(20)
{min..10}
{11..30}
{31..max}
MERGE RANGE(30)
{min..10}
{11..20}
{21..max}
Conversely, with a
RANGE LEFT
partition function, the data from the left partition is moved to the right partition
filegroup, as shown in Table
15-5
.