Solved

Managing Sliding Window in SQL partitions

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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What type of testing am I doing? 4 76
Server 2012 r2 and SQL 2014 6 34
Sorting a SQL script 5 41
Creating a View from a CTE 15 49
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

739 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