I would resize all columns and then run the maintenance on the db. There is no need to do it after each column resize.
When to shrink: after reducing the size of one column or after reducing the size of all columns?
Domanda
We have a huge database (300GB) where most of the space is occupied by a large table. This table has a number of columns that were defined as float, ocuppying 8 bytes each. However recently we realized that only 4 bytes are needed and we have to change the size of each column so we have to run queries like this one for every column (around 6 columns):
alter table [HugeTable] alter column [Col] float(1)
My question is: how and when should we reclaim the space after reducing column size? For the question of when we have two possibilities: after each alter table (disadvantage: it takes longer) or after all columns were reduced. For the question of how our thoughts are: db shrink, clustered index rebuild. Also would DBCC CLEANTABLE be useful in our case? From what I could understand it is useful only for variable column types.
Thanks!
EDIT: In the end we decided not to use this approach. Instead we are creating a table with the new structure and gradually moving the data.
Soluzione