• This site is read-only while we complete some maintenance. You can't create or edit pages right now.

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


The following scripts can be used to identify and defragment any SQL indexes that might be causing database slowdown. This script can be put into a batch file and run as a scheduled task, run manually or as a stored procedure.


It is highly recommended to take backups before performing any SQL operations.  Failure to perform proper backups may result in permanent data loss.


After running this script, it is recommended you run the first script "Identifying Fragmented Index Script"  once again to see if you’ve lessened the fragmentation. Continue to do this until you see fragmentation go away entirely or until larger indexes are showing minimal fragmentation. It may never completely go away, but lessening index fragmentation can definitely help speed up a database and make things run a little smoother.