In SQL Server, if Database Restore Time takes less time compare to Index Rebuilds OR Reorganize . Can we Choose Restore as a option for DE-fragmentation. If its not a 24/7 database.
migrated from stackoverflow.com Jul 12 '12 at 23:10
|
That doesn't make much sense. If you restore a database from a time earlier, you won't be capturing data that has changed since the backup. (but I'm assuming you mean a backup directly followed by a restore) If you're talking about taking a full backup and then immediately a restore, then you will persist the fragmentation in the restored database as it was when it was backed up. So either way I will say no that is not advisable. Prudent index rebuilds/reorganization based on the fragmentation is best practice. See this blog post that on database restoration and index fragmentation that debunks that myth. Restoring a database also restores the fragmentation at the time of the backup. |
|||
|
|
|
In general no, the restore, at least in "modern" sql servers, is optimized to read and write data quickly. The indexes are left as they were at the time of backup. |
|||
|
|
|
The DB restore may de-fragment (physically) at the disk level, but there will still be the same internal fragmentation at the page level. Hence you will still need to do your index maintenance. |
|||
|
|
No, it doesn't work that way. There are two layers at work here that you should be concerned with (there are more if you consider the underlying storage subsystem, but I'll ignore this here):
Given these two factors, it's recommended to (a) run index maintenance procedures to eliminate the internal database data file layout fragmentation, and also (b) run Defrag at the Windows level to eliminate physical storage layout fragmentation*. Doing only one of the two does not eliminate the need for the storage device to do random I/Os. Doing a restore as you suggest may eliminate the physical storage fragmentation, but it won't eliminate the internal data file fragmentation. * Physical-level (and lower) defragmentation is not recommended for SSD-based storage. |
|||
|
|
