The most common way to improve the performance of our queries to large tables containing both current and historical data is to use horizontal partitioning. Prior to SQL Server 2005, this strategy can be materialized with a partitioned view that union multiple copies of a table with the same structure that contain sets of horizontally partitioned data.
However in SQL Server 2005, there is now a new feature called Partitioned Tables. The data contained in partitioned tables can be horizontally spreaded across one or more filegroups in the database and these filegroups can be deployed to several disks to improve performance. This feature is not limited to tables alone, indexes too can be partitioned.
To demonstrate this feature, we start by defining a partition function.
CREATE PARTITION FUNCTION MonthPartition(int)
AS RANGE FOR VALUES (3, 6, 9)
The partition function specifies that four partitions (<=3, 4-6, 7-9, >9) are to be created and it only applies to an int column.
Next, create the partition scheme.
CREATE PARTITION SCHEME MonthScheme
AS PARTITION MonthPartition
TO (q1fg, q2fg, q3fg, q4fg)
The above partition scheme specifies that all the four partitions defined in the partition function will be spreaded across four filegroups (Example assumes that the filegroups have already been created).
Finally, create the partitioned table.
CREATE TABLE Orders (OrderID int, OrderMonth int, OrderDate DateTime)
ON MonthScheme (OrderMonth)
That's all to it.
Home »Unlabelled » SQL2005: Partitioning
Popular Post
-
I've been looking into the programmable aspects of SQL Server 2005 for the past days and one of the things that interest me most is the ...
-
ARC312 - Enterprise Architecture by Gurpreet Pall Started day 2 with a dose of Enterprise Architecture. I like Gurpreet's example of ...
-
What a disappointing day! :( Started the day with a massive traffic congestion in the main road not far from my house. Stucked there for al...
-
Got curious about the Firebird database today. Heard of it for quite sometime but never tried it. One of my friends has been giving a lot o...
-
M anaging indexes in SQL Server 2005 has changed. All the index management functions are now located in a new and more standardized, ALTER I...
-
I was roped in to work on Active Directory these two days as the dudes in the MIS department had ran out of ideas. I was approached by my CI...
-
"Too many cooks spoil the broth" As the famous saying goes but will too many developers spoil the code ? It actually depends on ...
-
Have been hooked on Zuma lately (an online game provided by MSN). Never imagined that such a simple game can be so addictive. Previously, I...
-
Have you ever wished to be able to work from home? You know like, sitting on that nice comfy chair (or slumber on the bed), listening to the...
-
Day 4 of J2EE training. Today, we completed everything on Enterprise Java Beans (EJB). For the past two days, we learnt about Session Beans,...
No comments:
Post a Comment