I have a table that we keep a rolling 14 day amount of data in. The daily delete remove approx 30K rows. This slow the server greatly during the delete. process runs at night.
What i was thinking was that i could make a partitioned table that keeps the data split.
Partition 1 is all rows <= 14 days
Partition 2 is all rows > 15 days
Created 2 file groups and to DB files to test with.
Problem I have now is that all the date range examples partiion by specific date ranges. How would you partition by a rolling date range???
Thanks
John Fuhrman
What i was thinking was that i could make a partitioned table that keeps the data split.
Partition 1 is all rows <= 14 days
Partition 2 is all rows > 15 days
Created 2 file groups and to DB files to test with.
Code:
-- Create File Groups for Partitioning Data
ALTER DATABASE SQL_TEST ADD FILEGROUP WDSCRN;
go
ALTER DATABASE SQL_TEST ADD FILEGROUP WDSCRN_Archive;
Go
-- Create the Physical DB files for partitioning
ALTER DATABASE SQL_TEST
ADD FILE
(NAME = N'WDSCRN',
FILENAME = N'D:\SQL\SQL_TEST_WDSCRN.ndf',
SIZE = 5MB,
-- MAXSIZE = 100MB,
FILEGROWTH = 5MB)
TO FILEGROUP [WDSCRN];
Go
ALTER DATABASE SQL_TEST
ADD FILE
(NAME = N'WDSCRN_Archive',
FILENAME = N'D:\SQL\SQL_TEST_WDSCRN_Archive.ndf',
SIZE = 5MB,
-- MAXSIZE = 100MB,
FILEGROWTH = 5MB)
TO FILEGROUP [WDSCRN];
Go
Problem I have now is that all the date range examples partiion by specific date ranges. How would you partition by a rolling date range???
Thanks
John Fuhrman