﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Hugh Scott / Article Discussions / Article Discussions by Author  / Automate Sliding Window Partition Management: Part I / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 04:53:51 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>[quote]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 ?[/quote]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 RANGETo remove the boundary of the oldest partition, you issue the MERGE command.[quote]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 ?[/quote]This will not work because in order for you to switch in and out of partitions, you need to be in the same filegroup. </description><pubDate>Thu, 16 Dec 2010 11:56:58 GMT</pubDate><dc:creator>willtwc</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>[quote][b]Chris Hamam (12/15/2010)[/b][hr][quote][b]Hugh Scott (12/14/2010)[/b][hr][quote][b]amenjonathan (12/14/2010)[/b][hr]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)?[/quote]Nope.  The index gets created on the default file group.  Not that I would know from experience!:-DRegards,Hugh[/quote]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![/quote]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!</description><pubDate>Thu, 16 Dec 2010 09:18:21 GMT</pubDate><dc:creator>amenjonathan</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>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 ?RegardsJimmy</description><pubDate>Wed, 15 Dec 2010 21:35:36 GMT</pubDate><dc:creator>jimmy.kooruvelil</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>[quote][b]Hugh Scott (12/14/2010)[/b][hr][quote][b]amenjonathan (12/14/2010)[/b][hr]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)?[/quote]Nope.  The index gets created on the default file group.  Not that I would know from experience!:-DRegards,Hugh[/quote]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!</description><pubDate>Wed, 15 Dec 2010 13:57:43 GMT</pubDate><dc:creator>Chris Hamam</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>[quote][b]bpportman 52825 (12/14/2010)[/b][hr]Is there any performance gain when partitions are on the same set of spindles (can be same file group or different)?[/quote]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</description><pubDate>Tue, 14 Dec 2010 15:00:09 GMT</pubDate><dc:creator>Hugh Scott</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>[quote][b]amenjonathan (12/14/2010)[/b][hr]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)?[/quote]Nope.  The index gets created on the default file group.  Not that I would know from experience!:-DRegards,Hugh</description><pubDate>Tue, 14 Dec 2010 14:55:48 GMT</pubDate><dc:creator>Hugh Scott</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>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)?</description><pubDate>Tue, 14 Dec 2010 13:54:01 GMT</pubDate><dc:creator>amenjonathan</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>Is there any performance gain when partitions are on the same set of spindles (can be same file group or different)?</description><pubDate>Tue, 14 Dec 2010 13:32:16 GMT</pubDate><dc:creator>bpportman 52825</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>@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</description><pubDate>Tue, 14 Dec 2010 12:42:39 GMT</pubDate><dc:creator>Hugh Scott</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>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.</description><pubDate>Tue, 14 Dec 2010 12:04:24 GMT</pubDate><dc:creator>willtwc</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>[quote][b]peter-757102 (12/14/2010)[/b][hr]The article states the following:[quote]First off, you need SQL Server Enterprise Edition or Developer Edition. None of the other editions of SQL Server 2005 or 2008 support partitioning. SQL Server 2000 and earlier do not support partitioning at all.[/quote]This is not entirely correct, the devil is in the details!Partitioning is supported, I believe all the way back to SQL Server 2000, but it works in an entirely different way then the more advanced method of partitioning functions. Which are indeed only available in Developer and Enterprise versions.&amp;lt;snip&amp;gt;[/quote]That is called a Partitioned View. Although it looks similar, it is different from Partitioned Tables.@Hugh, does the other parts of your article disucss what happens to the data and you move partions around? Or more importantly, how to avoid data movement? I think this is one area of Partioned Tables that really bites people who don't understand how/why Microsoft setup partioned tables like they did.</description><pubDate>Tue, 14 Dec 2010 11:55:27 GMT</pubDate><dc:creator>Lamprey13</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>Thanks for the article.  I have a use for it already.</description><pubDate>Tue, 14 Dec 2010 10:46:04 GMT</pubDate><dc:creator>SQLRNNR</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>Are there any performance concerns when partitioning with a single filegroup apart from the restrictions on I/O increases from not using multiple disks? We're about to implement a partitioned table, and it looks like we're using just one filegroup. Every document I read talks on and on using 1 filegroup per 1 file, but I can't find much if any info on single filegroup solutions.Secondly, I've read if you add an index to a partitioned table and you do not add the partitioned column to the index, SQL will add the partitioned column anyway in the background, thereby making any index added to a partitioned table aligned by default. Need some clarity on this point as well, because it has been suggested we do not need to add the partitioned column because of this. I would like to add it regardless just to be sure. Can't do that unless there's a reason.</description><pubDate>Tue, 14 Dec 2010 10:22:44 GMT</pubDate><dc:creator>amenjonathan</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>The article states the following:[quote]First off, you need SQL Server Enterprise Edition or Developer Edition. None of the other editions of SQL Server 2005 or 2008 support partitioning. SQL Server 2000 and earlier do not support partitioning at all.[/quote]This is not entirely correct, the devil is in the details!Partitioning is supported, I believe all the way back to SQL Server 2000, but it works in an entirely different way then the more advanced method of partitioning functions. Which are indeed only available in Developer and Enterprise versions. Here is an old script that I posted once on SQL ServerCentral.com to demonstrate partitioning at work using noting but several partition tables and a view to unify them as if they were one large table. And yes, you can insert in such views without writing any instead-of trigger on your part. Some not so obvious restrictions (there always are those, sigh):* When inserting records, you need to specify all columns, even those that accept NULL values.* You cannot do a modification trough the view when the query also uses a "select" that references the unified view or one of its patritions.The script is attached as a file for ease of use and contains some comments to help people on their way.</description><pubDate>Tue, 14 Dec 2010 08:59:13 GMT</pubDate><dc:creator>peter-757102</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>Excellent overview of Partitioning and Sliding-Window by Kimberly Tripp that provides background into why, how and technical implementation details.[url=http://msdn.microsoft.com/en-us/library/ms345146(SQL.90).aspx]http://msdn.microsoft.com/en-us/library/ms345146(SQL.90).aspx[/url]</description><pubDate>Tue, 14 Dec 2010 08:36:41 GMT</pubDate><dc:creator>Victor Alcazar-Vihho Technology</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>can you partition a table where you keep say 30-45 days of data. have it partition by day or week to make deletes and inserts faster?</description><pubDate>Tue, 14 Dec 2010 08:02:04 GMT</pubDate><dc:creator>alen teplitsky</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>Awesome.  This is really timely.  I just got Enterprise approved so I can implement partitioning and this series is going to be a huge help.  Is the Powershell script coming in one of the next articles.  I didn't see it with this article.</description><pubDate>Tue, 14 Dec 2010 06:54:19 GMT</pubDate><dc:creator>bpportman 52825</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>This article is actually in three parts.  The next two parts describe automation of partition maintenance (adding partitions at the "top" and removing partitions from the "bottom").My understanding is that they will be published next week and the week after.Regards,Hugh Scott</description><pubDate>Tue, 14 Dec 2010 05:02:23 GMT</pubDate><dc:creator>Hugh Scott</dc:creator></item><item><title>RE: Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>How about the case when new data starts to fill your topmost partition? How do you avoid unnecessary data movement?When I implemented partitioning I had 2 topmost partitions and a SQL Agent Job running a SSIS package to react on the fullness of the second topmost partition. If it were getting full then we split the topmost partition. Only to avoid any kind of data movement./Johan Klövstedt</description><pubDate>Tue, 14 Dec 2010 01:23:58 GMT</pubDate><dc:creator>johan.klovstedt</dc:creator></item><item><title>Automate Sliding Window Partition Management: Part I</title><link>http://www.sqlservercentral.com/Forums/Topic1034182-234-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/articles/Partitioning/71655/"&gt;Automate Sliding Window Partition Management: Part I&lt;/A&gt;[/B]</description><pubDate>Mon, 13 Dec 2010 22:08:51 GMT</pubDate><dc:creator>Hugh Scott</dc:creator></item></channel></rss>