Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
DLTaylor
Posting Yak Master
136 Posts |
Posted - 2013-11-21 : 06:08:23
|
Hello,I regularly query large tables from a SQL 2005 data repository where the data has a Clustered Index on a PK field. This cannot be changed. (And I cannot archive the data)The Repository tables contain data spanning 10 years where Inserts/edits/deletes are applied and the tables continue to increase in volume.When I query the DR tables I would typically use a WHERE clause with a date. A simplified example of the t-sql could be:SELECT *FROM DataRepositoryTableWHERE (ActivityDate >= CONVERT(DATETIME, '2013-04-01 00:00:00', 102))At the moment this Select will perform full table scan of the 10 years of data as there is no CI on ActivityDateMy question is:If I add a Partition on ActivityDate and split by groups of Years… will I avoid a full table scan as SQL will know to only query data from the partition containing 2013 data? (so is the action of partitioning by year is bit like clustering of the data on a YEAR column – I know this is too simplistic but maybe the essence is right?)Any advice on the above would be GREAT! |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
DLTaylor
Posting Yak Master
136 Posts |
Posted - 2013-11-21 : 08:27:42
|
This is great news, thanks! Cant believe it hasn’t been done before ;-)As im not the owner of the tables on the Data Repository, can i check that adding the date partition should in theory have no impact on the data in the tables updating - which is currently on the Inserts/updates/deletes looking at PK joins.I expect there would be none to minimal impact but thought i'd ask someone who has probably set up plenty of partitions in the past!Thanks again |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-21 : 08:46:16
|
the only impact would be movement of data from primary (or current partition) to various partitions that you're going to create based on files and filegroups used.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
DLTaylor
Posting Yak Master
136 Posts |
Posted - 2013-11-21 : 09:00:27
|
great; so the impact is only at the point of setting up the partitions (caused by the movement of data into file groups) and after that it should perform as previously.sorry for the additional questions, its almost too good to be true! ;-) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-21 : 09:45:06
|
yep...true------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|