Sql-server – Partition Function with only one value, what does this effect

partitioningsql server

I am currently looking at a database that has been setup by the default installation routine of AppFabric. Looking at the creation scripts I encountered this partition function:

CREATE PARTITION FUNCTION [MSAppServerPF_ASWcfEventsTable](datetime2(7)) AS 
RANGE RIGHT FOR VALUES (N'0001-01-01T00:00:00.000')
GO

And it is being applied to a table that way:

CREATE PARTITION SCHEME [MSAppServerPS_ASWcfEventsTable] AS 
PARTITION [MSAppServerPF_ASWcfEventsTable] TO ([PRIMARY], [PRIMARY])
GO

I wonder what this specific partition style effects in. I was under the impression that you store boundary values into the partition function by which the data will be partitioned.
Unfortunately, looking for this on the web I could not find a similar example using just one DATETIME2 value in the partition function definition.

Can someone shed some light on this for me?

Best Answer

You are correct in your thinking of the boundary values. Basically what your partition function dictates, is that anything greater than or equal to (range right) 0001-01-01T00:00:00.000 will be on the second partition, and anything less than that will be on the first partition.

The peculiar thing about the partition function is that there will never be any value less than 0001-01-01T00:00:00.000, due to the datetime2 date range. As far as I can see, this would mean that the first partition will never have data, and the second partition will have all of the data (provided there is no split going forward).

One thing this strategy could be used for is partition switching and sliding window operations. For more information on exactly what that is you can see it on this blog article. But as for this isolated partitioning structure as a standalone solution, I'm not convinced that there's anything gained here.