1

Since my question Index and statistics optimization scripts duration and log bloat problem. Looking for good strategy? has been closed because it was not focused enough I've three questions:

For statistics and index optimization I want to use Ola Hallengreens scripts.

  1. If I update statistics only or rebuild/reorganize indexes: Is there anyting dangerous by cancelling the job right in the middle of it if I see logfile becomes too big or the job takes too long and slows down daily work?

If not there is nothing I need to worry about and I can run it maybe on any evening or on a saturday and watch how it works and cancel it with no problem if some of the mentioned problems occur. Is this true?

  1. If I use Olas script configured like this (no offline index rebuild):
  • FragmentationLevel1 = 50%
  • FragmentationLevel2 = 80%
  • FragmentationMedium = ‘INDEX_REORGANIZE,INDEX_REBUILD_ONLINE’
  • FragmentationHigh = ‘INDEX_REBUILD_ONLINE’
  • @UpdateStatistics nvarchar(max) = 'ALL',
  • @OnlyModifiedStatistics nvarchar(max) = 'Y',

Can I use this safely during worktime when people are working on the database?

  1. Is there any dangerous by doing such maintenance jobs (statistics update/index rebuild/index reorganize) which could damage the database if I use Ola with those parameters? The only thing I've seen where growing a large log file. Or can I install this with no worries and if anything occurs just cancel it (see question 1)?
2

For question 1 - Cancelling or stopping the job after it is doing work will not roll back the work that has already been done, so there is no harm to stop it or kill the execution.

For question 2 - Keep in mind that online index rebuilds do still take some locks and there are limitations involved as to whether an online index can be performed. I would look here for a discussion of those limitations. I probably wouldn't run this script during the day, even if you can get the online index rebuilds to happen. Index maintenance can be resource intensive.

For question 3 - Ola's scripts aren't going to do anything that is going to damage the database.

When I looked at your other question, I had to wonder whether the index maintenance routine is causing the log file growth.

You say, "Because of the problem with the log partition running full after every database update I've received a different script which where I can set Proportion of maximum indexes to be maintained per database. But I think this script is not as powerful as olas script, maybe because it doesn't update statistics or doesn't rebuild enough indexes? I've inserted a lot of new data recently and some querys are really slow since then and it's up to the database."

It seems to me that part of your complaint is things run slow after you update and change a large amount of data and people suggested updating the statistics. You could do that with a separate Ola job with T-SQL like the below, which is on his site.

EXECUTE dbo.IndexOptimize @Databases = 'USER_DATABASES', @FragmentationLow = NULL, @FragmentationMedium = NULL, @FragmentationHigh = NULL, @UpdateStatistics = 'ALL'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.