SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 SQL Server Administration (2012)
 Estimating transaction log size after adding col
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ranvir_2k
Posting Yak Master

United Kingdom
160 Posts

Posted - 09/25/2013 :  10:14:55  Show Profile  Reply with Quote
Hi all,

I'm planning on adding an nvarchar(255) column to an existing table that has 24 million rows. The new column will have null values initially.

The table is 4GB in size.

Is there any way to calculate how much this will cause the transaction log to grow to?



Thanks

Edited by - ranvir_2k on 09/25/2013 10:31:34

James K
Flowing Fount of Yak Knowledge

3562 Posts

Posted - 09/25/2013 :  10:43:06  Show Profile  Reply with Quote
quote:
Originally posted by ranvir_2k

Hi all,

I'm planning on adding an nvarchar(255) column to an existing table that has 24 million rows. The new column will have null values initially.

The table is 4GB in size.

Is there any way to calculate how much this will cause the transaction log to grow to?



Thanks

It should cause almost no log activity assuming your alter statement is something like this:
ALTER TABLE YourTable ADD YourNewCol NVARCHAR(255) NULL;

On the other hand, if you were to add a non nullable column with a default value, it would result in a lot of log activity corresponding to each row.

There is one possible exception, which is that if adding the new column were to push one or more of the existing columns to row overflow data allocation units. But, on this, I don't know exactly how SQL Server handles it - whether it generates log records or not when it internally moves a column to overflow allocation units.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000