Solved

Managing Sliding Window in SQL partitions

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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 to return specific rows and columns, with various degrees of sorting and limits in place.

744 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

12 Experts available now in Live!

Get 1:1 Help Now