question

Bunty0956 avatar image
Bunty0956 asked

SQL Server update statistics

Guys, I have a requirement where I have to run a update stats job on all databases every day and the job has to run only for 2hrs and it should quit after starttime-systemtime=2hrs. Stats has to be updated in a incremental fashion. Any help would be appreciated.
sql-servertsql
2 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Just curious, why the 2 hour limitation? Is that your maintenance window? What issue are you trying to solve by updating stats daily?
0 Likes 0 ·
Yes, we have only 2 hr maintenance window. Trying to update stats in chunks daily.
0 Likes 0 ·

1 Answer

· Write an Answer
PhilParkin avatar image
PhilParkin answered
Have you looked at Ola Hallengren's DB maintenance solution? See [link][1]. There is a @TimeLimit argument for the IndexOptimize proc, which may be what you need. [1]: https://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.