concept partition in category sql

appears as: partition, partitions, partition, partitions, The partition
SQL Server MVP Deep Dives

This is an excerpt from Manning's book SQL Server MVP Deep Dives.

This table-valued DMF provides physical information about each index and partition in a table. For each b-tree level, IN_ROW_DATA allocation unit, LOB_DATA allocation unit and ROW_OVERFLOW_DATA allocation unit in each partition, a row is returned that includes the index and allocation unit type, fragment counts and sizes, average fragmentation percentage, page count, and row count. I use this view to obtain a picture of indexes that are candidates for rebuilding or reorganizing. This is slightly better than an educated guess, less work than running DBCC SHOWCONTIG over and over again, and much better than blindly running maintenance against all indexes on a fixed schedule. I have used various adaptations of Ola Hallengren���s index optimization scripts. They are located here, and are definitely worth some investigation: http://ola.hallengren.com/.

In figure 2, partition 3 is initially empty and a staging table S is created and loaded with data. Then S is swapped with partition 3 using the SWITCH operation. The result is that partition 3 has the data and the staging table is now empty. This operation involves metadata only, and only takes milliseconds to complete, no matter what the size of the new table. Because there’s no data transfer, no activity other than the metadata operation is logged in the transaction log. This is how table partitioning can load data quickly.

In this case, we end up placing the boundary value in the partition to the right of the cut:

{NULL, MinInt ... 9},
{10 ... 19},
{20 .. 29},
{30 ... MaxInt}

Again we end up with four partitions, but this time the boundary values fall into the partitions to the right: each boundary value becomes the lower bound of the rightmost set of partitions. Execute the following queries:

SELECT $PARTITION.PFNExample1_Right(NULL);
SELECT $PARTITION.PFNExample1_Right(9);
SELECT $PARTITION.PFNExample1_Right(10);
SELECT $PARTITION.PFNExample1_Right(11);
SELECT $PARTITION.PFNExample1_Right(20);
SELECT $PARTITION.PFNExample1_Right(21);

Now we see that 10 is in partition 2 as the lower bound, 20 is the lower bound of partition 3, and so on. The lower bound of partition 1 is NULL.

Figure 4. Task Manager results are local to the partition in which it runs.