We have some tables in an Oracle database with several million rows. When we alter one of these tables to add a new column, we specify a default. This is very slow to
run as Oracle has to update all existing rows with the default. The solution is to ensure the column is defined as NOT NULL because then Oracle (recent versions only)
will not update all existing rows with the default - the subsequent presence of a null in one of these columns tells Oracle that it requires a default and it will
provide the default on the fly.
My question is regarding SQL Server: does it exhibit similar behaviour when adding a column and providing a default? If not, are there any best practices in
efficiently adding new columns with default values, and are there any advantages in defining a column as NOT NULL?
Thanks in advance!