Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a big problem with the SQL Server Agent hostory. it has become VERY VERY slow when i try to view it. If I try through Management Studio I often get a timeout and if I try viewing it with sp_help_jobhistory it is just running for a long time.

I tried reducing the hostory size and the sysjobhistory table has only 8000 rows....

Is there any way to optimize this somehow?

Thx a lot Nicolaj

share|improve this question
up vote 2 down vote accepted

Ensure that the sysjobhistiory table is not fragmented. The easiest thing to do is reindex it. Since the table is so small, the reindex should happen quickly.

share|improve this answer
that did the trick! thx – NicolajB Jun 11 '12 at 12:57

You could try to more regularly cycle (start new) your agent log. That can be done with EXEC msdb.dbo.sp_cycle_agent_errorlog; . Perform this periodically and your logs will remain both smaller and more manageable. (I generally create an Agent job that cycles the log weekly.) BTW, you can also cycle the error log as well with EXEC master.sys.sp_cycle_errorlog;.

share|improve this answer
good idea.... i do it already on the error log – NicolajB Jun 11 '12 at 12:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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