Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

Split existing Partition - Grows log file in GBs and take hours to run

$
0
0

Hi,

I have an existing table with around 200 Million rows and couple of partitions.

I would like to split the partitions

e.g. the Latest partition hold the data where date >= '2012-01-01' and I want to create more partitions which holds the data for each quarter of 2012 and 2013... so roughly the highest partition will be split into 7 partitions i.e. 6 partitions to hold data for each quarter up to 06/2013 and 7 will be empty partition.

I tried the following but it grows the log file to 40 GB and ran for hours for just 1 split .. and I have to do 7 splits.

ALTER PARTITION SCHEME fn_schemename
	NEXT USED [Primary];ALTER PARTITION FUNCTION fn_schemename()
	SPLIT RANGE(N'2012-03-31T00:00:00.000');

Is there any other way to avoid the log growth.

One I think of is:

  1. Create a new table Table_B. 
  2. Create the required partitions using the existing partition scheme and functions.
  3. Copy the data from Table_A  to Table_B
  4. Drop the Table_A.
  5. Rename the Table_B  to Table_A

Have I missed any step? Is there any other way to avid log file increase and reduce the split time.

Regards,

Zee Ash


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>