Long query gets fixed by server restart

  • Hi,

    I've got a query which normally runs for 3 seconds in production, but in development it takes around 1 minute. After the development SQL Server service restart the query takes 3 seconds, but few days after it slows down to 1 minute again. I can see no blocking during the query execution.

    Any ideas?

    Thanks.

  • Instead of a restart have you tried dropping the procedure plan from the cache to see if it's just a case of bad parameter sniffing? In a development server you can just run DBCC FREEPROCCACHE. However, never do that to a production server. Instead get the plan handle from sys.dm_exec_query_stats or one of the other places that has the plan handle and then run DBCC FREEPROCCACHE(plan_handle).

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply