These pages cover SQL Monitor 12, which is not the latest version. Help for other versions is also available.
Improving performance of SQL Agent job history sampling
Published 21 October 2021
Maintenance of msdb.dbo.sysjobhistory is a routine part of administering a SQL Server instance. If you have opted to maintain very large volumes of job history the following index could help to improve the performance of SQL Monitor's query running on the monitored server:
CREATE NONCLUSTERED INDEX [rg_job_history] ON [msdb].[dbo].[sysjobhistory]
(
[job_id] ASC,
[instance_id] ASC,
[step_id] ASC
)
WHERE ([step_id]=(0))
You may change the name of the index, SQL Monitor does not use index hints for this index.