Data Warehouse Partition Strategies
Microsoft put a great deal of effort into SQL Server 2005 and 2008 to ensure that that the platform it is a real Enterprise class product. I’m not going to write about all the new features in the OLTP Engine, in this article I will focus on Database Partitioning and provide a real world scenario. This article will cover the following points:
I. Benefits and Limitations of Partitioning (HEAPS/CLUSTERED/NONCLUSTERED).
II. Implementation Methodology.
III. Partitioning Management.
I. Benefits and Limitations of Partitioning (HEAPS/CLUSTERED/NONCLUSTERED)
– Data can be accessed through multiple partitions in parallel, this results in faster DML.
– Different partitions can be managed separately.
– Management of history more efficient (without having to leave the table).
– Limit of 1000 Partitions by Table.
– Inability to use Indexed Views.
II. Implementation Methodology
I’m going to focus on the most common scenario. Typically, in a Data Warehouse environment there is a large Fact Table (a.k.a the Monster).
In this article the Fact Table contains all the banking movements of all accounts within the last 4 years in the MAIN database and the remaining years in a HISTORY database. In this case, because there is a chronology to follow, I will use the extract day date column of the table as the KEY to our Partition Strategy. In this situation, I recommend the creation of a Partitioned Clustered Index because typically all access to the fact table always has the date in the SARG. The fact table will be partitioned by month.
Storage Arquitecture – 3 RAID-5 Partition (2TB each), 1 RAID 01 for Transaction Log and 1 more RAID 01 for
First off all you will need to develop the Partition Function. The Partition Function defines the values which the partition scheme will bind with the Filegroups. Our boundary will be the date, and right range (boundary right aligned):
CREATE PARTITION FUNCTION PFFactTableMonthly (SMALLDATETIME)
AS RANGE RIGHT
Create the Datafiles and assign each file to a differente Filegroup. In this situation 27 Datafiles/Filegroups will be created. Now that the Filegroups are created, assign them to a Partition Scheme that acts like a ROUTER, because it will forward the data to a specified path. The Partition Scheme will use the Partition Function to link the logical layer to the physical layer:
CREATE PARTITION SCHEME PSFactTableMonthly
AS PARTITION PFFactTableMonthly
Now that we have the Partition Scheme, just create the Clustered Index on the Fact table with a FILLFACTOR 90% with PAD_INDEX on.
CREATE CLUSTERED INDEX [IDXC_FACTTABLE] ON MIS.FACTTABLE
WITH( PAD_INDEX = ON, FILLFACTOR = 90, STATISTICS_NORECOMPUTE = OFF,
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
on PSFactTableMonthly (DATECOLUMN)
Pages: 1 2