September 11, 2017 at 11:16 pm
I have partitioned my tables on a business date basis(365 partitions in a year). I want to do page compression on a daily basis of yesterday(D-1) data of all tables in a database. Any help on how to implement it ?? If you have any script please share.
September 12, 2017 at 7:42 am
How would you do this manually? If I said today, compress the partition from yesterday, what would you do? Likely you can get the code right and then look at how that changes to tomorrow? It's a simple parameter change. Make that part a script you generate.
A simple idea is use EXEC() to do this.
declare @cmd varchar(max)
select @cmd = 'compress_partition name = ''' + @somename + datepart(day, getdate()) + ''' with myoptions'
exec (@cmd)
September 12, 2017 at 11:14 pm
Steve Jones - SSC Editor - Tuesday, September 12, 2017 7:42 AMHow would you do this manually? If I said today, compress the partition from yesterday, what would you do? Likely you can get the code right and then look at how that changes to tomorrow? It's a simple parameter change. Make that part a script you generate.A simple idea is use EXEC() to do this.
declare @cmd varchar(max)
select @cmd = 'compress_partition name = ''' + @somename + datepart(day, getdate()) + ''' with myoptions'
exec (@cmd)
Now I am compressing like this.
USE [DBNAME]
ALTER TABLE [dbo]. REBUILD PARTITION = 14 WITH(DATA_COMPRESSION = PAGE )
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy