Beginner Table Partitioning Robert Smith robert@robertandcathy.com
Sources: Partitioned Table and Index Strategies Using SQL Server 2008*** http://technet.microsoft.com/en-us/library/dd578580(v=SQL.100).aspx Partitioned Tables and Indexes (SQL 2012) http://msdn.microsoft.com/en-us/library/ms190787(v=sql.110).aspx
Table Partitioning What is this all about? How do I set it up? How do I use it?
What is this all about? (benefits) Transferring large subsets of data quickly Maintenance in parallel Improve query performance
How do I set it up (What do I need to know?) What are the pieces I need? Partition function Partition scheme Partition key column What are aligned indexes and should I use them? Aligned indexes are built on the same partitioning scheme as the table they belong to
How do I set it up (partition functions) Left vs. Right -∞ 1 2 3 +∞ Left Right CREATE PARTITION FUNCTION [pf_MonthlyByDate](datetime) AS RANGE RIGHT FOR VALUES ( N'2013-01-01', N'2013-02-01', N'2013-03-01', N'2013-04-01' )
How do I set it up (partition scheme) CREATE PARTITION SCHEME ps_MonthlyByDate AS PARTITION pf_MonthlyByDate ALL TO ([PRIMARY]) vs. CREATE PARTITION SCHEME ps_MonthlyByDate AS PARTITION pf_MonthlyByDate TO ([PRIMARY],[PRIMARY],[PRIMARY],n...) or CREATE PARTITION SCHEME ps_MonthlyByDate AS PARTITION pf_MonthlyByDate TO ([FG1],[FG2],[FG3],n...)
How do I set it up (apply to a table) Create a table on the partition scheme that uses a partition function When should I use the Partitioning Wizard vs. hand coding it?
How do I use it (merge and spilt the function) SWITCH data in and out SPLIT RANGE ALTER PARTITION SCHEME [ps_MonthlyByDate] NEXT USED [PRIMARY]; ALTER PARTITION FUNCTION [pf_MonthlyByDate]() SPLIT RANGE ('20130501'); MERGE RANGE ALTER PARTITION FUNCTION [pf_MonthlyByDate]() MERGE RANGE ('20130501');
Thank You Sponsors Platinum Gold Silver Bronze Swag 4/2/2016