|
We have a table with 2 billion rows with an identity column defined as INT. I want to change it to BigINT. Is it faster to create a new table and insert all rows into new table or to Alter existing table and change the data type. If i do the second option, I also need to recreate the primary key that is on the identity column.
(comments are locked)
|
|
Based on the size of the tabel, I would
on one condition; that you have enough space in your database. By doing this, you will avoid Page Splits. You may also be able to avoid extensive down-time, as the insert may be able to run in parallel with your normal production work.
(comments are locked)
|
|
Based on the size, I would alter the existing table. It's going to take several steps though; create the column, migrate the data, change the PK, then remove the old column. Also, you my need to break this down into chunks to avoid filling your transaction log. +1 - don't forget the 'remove all FKs that reference the PK' :)
May 29 '10 at 06:37 AM
Matt Whitfield ♦♦
(comments are locked)
|

