We're implementing UDT changes in the big database. Earlier, that User Defined Type was based on smallint, and now we have to use int as the base.
smallint
int
The impact here is manyfold:
Now, we're trying to address (3), (5) and to implement (4), while trying to keep interface with clients using old types.
As for database size impact, we have found that an index fragmentation is a primary disk space waster (see Reorganize index in SQL Server). We have performed some partial index reorganization and can see now that we can gain back hundreds of GB of a disk space. On the other hand we use page compression, so we expect that change of types will not increase sizes of tables considerably. Indeed, our measurments show that tables will only be ~1-3% bigger.
The change of types of columns is untrivial task. The problem is that if you try to change column's type (which is part of clustered index) directly then you should temporary remove foreign keys, and to rebuild all indices. This won't work neither due to disk space required for the operation (a huge transaction log is required), nor due to availability of tables (we're talking about days or even weeks to rebuild indices).
To work-around the problem we have selected another way. For each target table T we performed the following:
Note that:
After transfer will be complete we shall drop T_old tables, and T views, and will rename T_new tables into T.
This will complete part 4 of the whole task. Our estimations are that it will take a month or even more to complete the transfer. However solution is rather slow, the database will stay online whole this period, which is required condition.
The next task is to deal with type changes in parameters of stored procedures and column types of output result sets. We're not sure yet what's the best way to deal with it, and probably shall complain about in in next posts.
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u