Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««123»»

Automate Sliding Window Partition Management: Part I Expand / Collapse
Author
Message
Posted Tuesday, December 14, 2010 12:04 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Yesterday @ 5:43 PM
Points: 37, Visits: 364
I have implemented partitioning on a few larges tables. However, I switch over to single filegroup for ease of maintenance or lack of filegroup maintenance.

The underlying logical drives has 20 odd physical disks. Having each file in each filegroup does not make much difference in my setup.

Post #1034636
Posted Tuesday, December 14, 2010 12:42 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, April 03, 2014 7:35 PM
Points: 401, Visits: 166
@Lamprey13,

In reviewing the other two parts, I don't think I specifically address the idea of avoiding data movement (data moving from one file or file group to another because of changes to partition boundaries). However, that was one of my primary goals in implementing partitioning.

In the context of the sample database and the partitions that are included in this series, the method to avoid unnecessary data movement is to schedule the scripts to run just prior to the end of the month (in our case, a couple of days before the end of the month).

- SplitPartition.ps1 (covered next week) will create a new "top end" partition. By running it just before the end of the month *before new records are inserted beyond the new boundary date*, you can avoid data movement.

- MergePartition.ps1 (covered on the 28th) will eliminate the lowest trailing edge partition. This can really be done any time (in accordance with business rules and retention policy). MergePartition.ps1 avoids data movement by "switching" the data into a staging table on the same file group as the data that is to be removed, then dropping the partition and finally dropping the staging tables. In addition, it cleans up the files and file groups that are associated with the dropped partition.

By scheduling both scripts to run at the same time, I have a single job to track.

I should really have added this into the introduction or the summary of the series, but I'm glad that you pointed it out.

Regards,

Hugh



Post #1034663
Posted Tuesday, December 14, 2010 1:32 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, April 17, 2014 8:50 AM
Points: 22, Visits: 277
Is there any performance gain when partitions are on the same set of spindles (can be same file group or different)?
Post #1034694
Posted Tuesday, December 14, 2010 1:54 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, December 16, 2013 10:42 AM
Points: 96, Visits: 434
Thanks merlin for your reply and Hugh for this article. Looking forward to the next two installments.

Anybody have any idea what happens when you do not add the partitioned column to an index? Does it still create an aligned index (by secretly adding it anyway)?


-------------------------------------------------------------------------------------------------
My SQL Server Blog
Post #1034721
Posted Tuesday, December 14, 2010 2:55 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, April 03, 2014 7:35 PM
Points: 401, Visits: 166
amenjonathan (12/14/2010)
Thanks merlin for your reply and Hugh for this article. Looking forward to the next two installments.

Anybody have any idea what happens when you do not add the partitioned column to an index? Does it still create an aligned index (by secretly adding it anyway)?


Nope. The index gets created on the default file group. Not that I would know from experience!

Regards,

Hugh



Post #1034795
Posted Tuesday, December 14, 2010 3:00 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Thursday, April 03, 2014 7:35 PM
Points: 401, Visits: 166
bpportman 52825 (12/14/2010)
Is there any performance gain when partitions are on the same set of spindles (can be same file group or different)?


There's probably something to be gained from parallel query processing. I seem to recall that 2008 resolves some issues related to parallel query processing and partitions that were problematic in 2005.

However, performance for us was not the driving factor for partitioning the tables. I have had some very painful experiences dealing with poorly thought out purge strategies that kill performance, explode transaction logs and otherwise make a general mess of things. My primary goal was to create a fast, extensible process to purge lots of data very quickly each month with minimal impact to other processes.

Regards,

Hugh Scott



Post #1034801
Posted Wednesday, December 15, 2010 1:57 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, April 23, 2013 3:29 PM
Points: 73, Visits: 520
Hugh Scott (12/14/2010)
amenjonathan (12/14/2010)
Thanks merlin for your reply and Hugh for this article. Looking forward to the next two installments.

Anybody have any idea what happens when you do not add the partitioned column to an index? Does it still create an aligned index (by secretly adding it anyway)?


Nope. The index gets created on the default file group. Not that I would know from experience!

Regards,

Hugh



From vague memory and recollections of BoL, the partitioned column is added (as an included column) to a non-clustered index only if there is no clustered index... although please don't quote me on this!


--Chris Hamam

Life's a beach, then you DIE (Do It Eternally)
Post #1035464
Posted Wednesday, December 15, 2010 9:35 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, November 17, 2013 9:10 PM
Points: 1, Visits: 148
Thanks Hugh for the article which came on the right time for me.

I am about start working on a partitioning a "continuous loading" event table. The requiremnt is to have 12 months of data online and the data aged "gracefully".
I will have 12 data partitions + the lower partition. Each partiton will have its own file group, to ensure the most important aspect of recoverability. In case of DR, I can restore the filegroup which contains the current partion and the system is ready to go. It is about 10GB data in each partition, so no need to wait for 120 GB data to be restored to have the system available. IMHO partition/filegroup alignment is very important from point of system availability.

Sliding window will be implemented to switch in and switch out partitions.

Few thoughts/questions below.

1. Rather than sliding the window that moves forward in time by creating new partitions, can we use a "rotating window" which uses partitions in a ring structure? In this scenario we have a partition scheme with fixed names for each month. The script identities the new month and decides which partition will be used within the "ring". Then switches out data using a temp table on that filegroup to archive, truncate the table and switch back in for the new month. The advantage is that the partition number could be easily identified with current month. Any thoughts on this ?

2. I would love to to keep current quarter data on a filegroup on faster (RAID 10) disk (which handles the loading and most 80 percent of user queries) and previous quarters on slower disks until it get archived to very very slow disk. This means I have to switch out data between quarters which involves data movement. This would have ensured that the data is "aged gracefully". Any thoughts on this ?

Regards

Jimmy


Post #1035632
Posted Thursday, December 16, 2010 9:18 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Monday, December 16, 2013 10:42 AM
Points: 96, Visits: 434
Chris Hamam (12/15/2010)
Hugh Scott (12/14/2010)
amenjonathan (12/14/2010)
Thanks merlin for your reply and Hugh for this article. Looking forward to the next two installments.

Anybody have any idea what happens when you do not add the partitioned column to an index? Does it still create an aligned index (by secretly adding it anyway)?


Nope. The index gets created on the default file group. Not that I would know from experience!

Regards,

Hugh



From vague memory and recollections of BoL, the partitioned column is added (as an included column) to a non-clustered index only if there is no clustered index... although please don't quote me on this!


I think this is impossible actually. You must have a clustered index on the partitioned column in order to create a partitioned table. But in the same thread, every non-clustered index contains the clustered index as a reference, unless I'm remembering incorrectly. A non-clustered index on a heap table...not sure what the heck is going on in that scenario. haha!


-------------------------------------------------------------------------------------------------
My SQL Server Blog
Post #1035926
Posted Thursday, December 16, 2010 11:56 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Yesterday @ 5:43 PM
Points: 37, Visits: 364
1. Rather than sliding the window that moves forward in time by creating new partitions, can we use a "rotating window" which uses partitions in a ring structure? In this scenario we have a partition scheme with fixed names for each month. The script identities the new month and decides which partition will be used within the "ring". Then switches out data using a temp table on that filegroup to archive, truncate the table and switch back in for the new month. The advantage is that the partition number could be easily identified with current month. Any thoughts on this ?


the problem is your oldest partition is most likely be partition no 2. you will need swap in the latest data into whole new partition because you need to insert a new boundary into the partition scheme.

ALTER PARTITION FUNCTION ' @partitionscheme' () SPLIT RANGE

To remove the boundary of the oldest partition, you issue the MERGE command.

2. I would love to to keep current quarter data on a filegroup on faster (RAID 10) disk (which handles the loading and most 80 percent of user queries) and previous quarters on slower disks until it get archived to very very slow disk. This means I have to switch out data between quarters which involves data movement. This would have ensured that the data is "aged gracefully". Any thoughts on this ?


This will not work because in order for you to switch in and out of partitions, you need to be in the same filegroup.


Post #1036038
« Prev Topic | Next Topic »

Add to briefcase ««123»»

Permissions Expand / Collapse