Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>No one can tell how much time will the operation cost as this depend on many ither factors after all. </p> <p>You should not be worried about the operations itself because the SQL Server is doing everything right:</p> <blockquote> <p>The Database Engine uses schema modification (Sch-M) locks during a table data definition language (DDL) operation, such as adding a column or dropping a table. During the time that it is held, the Sch-M lock prevents concurrent access to the table. This means the Sch-M lock blocks all outside operations until the lock is released.</p> </blockquote> <p>I have never done <code>ALTER</code> operation on such amount of data and the only advice that I can give is to do it when there are not so many connections to the database (during the night).</p> <p>EDIT: </p> <p><a href="http://www.sqlskills.com/blogs/paul/misconceptions-around-adding-columns-to-a-table/" rel="nofollow">Here</a> you can found more information about your question. Generally, <code>Matt Whitfield</code> is right and</p> <blockquote> <p>The only time that adding a column to a table results in a size-of-data operation (i.e. an operation that modifies every row in a table) is when the new column has a non-null default.</p> </blockquote> <p>and when</p> <blockquote> <p>New column is nullable, with a NULL default. The table's metadata records the fact that the new column exists but may not be in the record. This is why the null bitmap also has a count of the number of columns in that particular record. SQL Server can work out whether a column is present in the record or not. So – this is NOT a size-of-data operation – the existing table records are not updated when the new column is added. The records will be updated only when they are updated for some other operation.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload