I have a table with an identity column that is also a primary key. Currently, it has 50 million rows, with the highest value of the identity column sitting at 148,921,803. The table has a lot of DELETEs and INSERTS performed on it, hence the high value.
We want to change the data type from INT to BIGINT to prepare for the addition of more rows. Note that, there are no references to the PK column.
What is the best way to do this, with minimal downtime? I have two options.
- Drop the PK and alter the column; or
- The copy-drop-rename method, as described here: