When changing an INT column to a BIGINT column on a table with over a 1 billion rows, is it still best practice to create a new table and then migrate the data, or is an ALTER COLUMN
just as effective these days?
Not overly worried about downtime.
When changing an INT column to a BIGINT column on a table with over a 1 billion rows, is it still best practice to create a new table and then migrate the data, or is an ALTER COLUMN
just as effective these days?
Not overly worried about downtime.
1条答案
按热度按时间gg58donl1#
is it still best practice to create a new table and then migrate the data,
That's just a workaround for running out of log space, or excessive blocking, or rollback time in case of failure. So if you've got plenty of time and resources, just ALTER the table.
Just be aware that once you start the ALTER TABLE you're committed to let it finish or wait a possibly long time for it to roll back if you cancel it.
Bulk loading a new table can be aborted with little cost, as only the extent allocations need to be rolled back.