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
-
There were lots of issues to contend with up to the end, but got through with flying colors. Consumer reports had something to say about our...
-
V12 / 5.576 cc / 385 PS / 406 ft/lb (550 Nm) @ 4.000 / 0 - 62 mph (100 km/h): 6,6 s / Vmax: 155 mph (250 km/h) (click images for a larger ...
-
Photo: Diane Edwardson, February 18, 2012. Native California Black Walnuts are sprouting leaves on the Red Car Property. (Click on photo t...
-
Tony Blair came to DC to say farewell. And make one final pitch for American cooperation on climate change. At a Rose Garden press conferen...
-
T he most common way to improve the performance of our queries to large tables containing both current and historical data is to use horizon...
-
Advice for children from the Department for Transport via deep-cover agents at Manchester Cycling . The implication of all the clever games...
-
One of the most impressive cars to bow at the recent 2012 Pebble Beach Concours d’Elegance in California was the second concept model to com...
-
I discovered data annotations while I was learning ASP.NET Web Forms Model Binding sometime back. From a little reading, I got to know tha...
-
"W hy are you always taking exams?!" - That's a common question from people I know. Yeah! If you notice it, I'm always tak...
-
M anaged to return home in one piece. I'm exhausted and braindead from hours of grinding and grilling. True to what I guessed, the exam ...
No comments:
Post a Comment