Sql-server – Will Rebuild and Reorganize improve Database Migration Script performance execution

performancequery-performancesql-server-2008visual studio

I would like to know if a Database Schema Migration Script (generated by Visual Studio 2008 or greater) will run faster if my target database got indexes rebuilt and/or reorganized.

Note: For all tables, when index fragmentation level is between 5% and 30% I reorganize the index. When index index fragmentation level is above 30% I rebuild the index.

Note 2: Database schema migration script generated by Visual Studio has a lot of commands to alter table structure, add constraints, foreing keys and indexes in order to keep target database structure updated/syncronized with files contained in our Database project (.dbproj file).

Best Answer

If you are just migrating the Schema itself, and not any of the data, Index Fragmentation of your user database tables should be irrelevant. The instructions in the migration script will come from system database tables holding the metadata for your user database/schema.