Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Managing Sliding Window in SQL partitions

Posted on 2013-11-27
4
Medium Priority
?
527 Views
Last Modified: 2013-12-01
Can some experts can tell the usage of Sliding Window in SQL partitions?

And i was to have dynamic partitions on the table.

Say
Today i have partition like below :
Day 1
getdate() should to partition file 1
getdate() +1should to partition file 2
getdate()+1 >should to partition file 3

So next day
Day 2
getdate() [mentioned in Day1]should move to file 2
getdate()+1 [mentioned in Day1]should move to file 3
getdate()[Day2] should move to file 1

Is can be achieved through Sliding Window
0
Comment
  • 2
  • 2
4 Comments
 
LVL 13

Expert Comment

by:magarity
ID: 39682159
Well in day 2 you probably don't actually want to move the data to another file, do you? It's better to just make a new partition with day2+1 and then use ALTER PARTITION MERGE RANGE (http://technet.microsoft.com/en-us/library/ms186307.aspx) to divide up any records in the date+1> file between the new day+1 and the day+1>.

But the better way to do it is to just make partitions well in advance so the +1> partition never gets any records in the first place. Just have a monthly script that adds another months' worth of partitions and at the same time drops off the ones that are too old.
0
 
LVL 5

Author Comment

by:VIVEKANANDHAN_PERIASAMY
ID: 39682184
What is sliding window then?
0
 
LVL 5

Author Comment

by:VIVEKANANDHAN_PERIASAMY
ID: 39682202
My scenarios is,

I need only 7 days data and rest all the data should be archived to the separate filegroup.
And each week i don't want to drop the create partitions, it should happened automatically.
While trying this, i came to concept called sliding window.Will this help me?
0
 
LVL 13

Accepted Solution

by:
magarity earned 2000 total points
ID: 39682707
"Sliding Window" is just a term for a technique. It is not an actual command.  Here is an article on Microsoft Technet that explains how to use the technique.  You can use it to do a 7 day range. It will work as I mentioned, the records will not actually move to another file each time:
http://technet.microsoft.com/en-US/library/aa964122(v=SQL.90).aspx
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question