@TimeLimit setting in Ola-Hallengren’s IndexOptimize Running Much Longer Than The Value Set

index-maintenanceindex-tuningola-hallengren

We start our indexing at 10:00 PM every evening and we want to allow it run until 4:30 AM, the next day. Therefore, we set the @timelimit variable / parameter to 23400 seconds. The issue is that the system continues to run well past the allotted time, by over 3607 seconds, or until I shut it down.

Thoughts on why it would not stop processing all commands, which is what the code is to promote via the variable?

Best Answer

As explained in the documentation (and evident from the procedure source code), TimeLimit is used to

Set the time, in seconds, after which no commands are executed.

(emphasis above is mine).

A command that started before the threshold will keep running until it completes.