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
-
If you were 3 years old, what car do you want your parents to own? It's not an easy question to ask a 3 year old as there answers are l...
-
There needs to be a book called Carpooling for dummies written by art car central that helps people drive and park in around swimmin...
-
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 ...
-
Aston Martin has today confirmed the company's intention to revive the historic British Lagonda marque. In a statement announcing the n...
-
go full screen on the below video found on http://www.jalopyjournal.com/?p=16967 famed auto designer Daniel Simon to pen up a concept and ...
-
This car sent in by Jake Stichler This is a 92 F150, currently residing in Lebanon, PA with nearly a quarter million miles that I picked up ...
-
Talks in Brussels between troubled banking group RBS and the EU have raised the prospect that the group's major motoring brands Direct L...
-
The Bubble Truck is a modified 2001 Dodge Ram 1500 extended cab pickup truck "sculptured" with a variety of ornaments and other d...
-
From what I recall from reading the superb book 'The Fast Set' about the British land speed record racers in the 1920's and 1930...
-
Here's our undercover agent "Codename JannieJumbo" cycling about maintaining his legend as an 'activist' within the so...
No comments:
Post a Comment