Solved

Managing Sliding Window in SQL partitions

Posted on 2013-11-27
4
506 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 500 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
I have a large data set and a SSIS package. How can I load this file in multi threading?
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now