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
-
Required reading: Bill Moore's EVWorld review and Martin Zimmerman's LA Times piece about their test drives of the Toyota Plug-in ...
-
Lately, I have encountered several questions regarding the performance of Entity Framework (EF) . I have been conducting feasibility study o...
-
Because out of it comes gems like these. Mrs. Dalloway by Virginia Woolf “The only good thing to say about this 'literary' drivel i...
-
in the middle of the gauge above, on the left it says "Park" and on the right "City" ... and in the below photo on the ...
-
http://www.imdb.com/title/tt1979320/ A biography of Formula 1 champion driver Niki Lauda and the 1976 crash that almost claimed his life. t...
-
After I published the benchmark results for Entity Framework (EF) vs. DAAB , I was asked to verify whether the performance of EF can be imp...
-
Lots to see in this photo which demonstrates the anatomy of an Aberdeen Street: in this case, Broomhill Road. Essential Services. The driver...
-
Photo: Diane Edwardson, December 22, 2010. There's nothing more iconic than the LA River/Egret/plastic bag/shopping cart photo. (Cl...
-
According to a new report from Autoweek , the future of the V12 engine under the Daimler nameplate will be left in the hands of Mercedes-Ben...
-
Digital Slot Car Racing in 1/32 Scale by Dave Chang (Crowood Press, 2011, $34.95) Reviewed in April 2012 by Philip Hendrickson Dave Chang’s...
No comments:
Post a Comment