Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Managing Sliding Window in SQL partitions

Posted on 2013-11-27
4
Medium Priority
?
521 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

704 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