Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Rebuilding large database tables and indexes

$
0
0
I have come across a database system which isn't designed to work optimally. It is fairly large (~400GB) and performance of loading and querying is degrading (improper data types, fragmented indexes, non unique clustering key and other problems). So, I have quite a task in front of me, but I am up for the challenge. I figure this is not a unique situation, many of us would have come across this before, so I am looking for gotcha's and advice. I have done this before too, but only for smaller databases, some of the operations here I expect to take a couple of hours or more to complete (depending on load/infrastructure speed etc, I know).My plan is thus:+ Take a full backup of the database+ Set the recovery model of the DB to simple+ Drop non clustered indexes+ Drop clustered indexes+ Remove PKs (wrong data types, too large!)+ Narrow data types (add new column, update column in batches to old value, rename new column to old column)+ Add PKs, which will create clustered indexes automatically based on PK ID+ Create non clustered indexes+ Run a SHRINKDB (normal operations I would never do this, but this is a special case, ensure log file is truncated to a logical size especially after all those table modifications...)+ Set the recovery model of the DB to Full+ Ensure everything works OK or betterHow is my plan? Thoughts?

Viewing all articles
Browse latest Browse all 3145

Trending Articles