Procedure Executionn Time Problem

  • Hi All,

    I have a interesting problem and I dont understand cause of problem.

    Please help me =)

    On production system,I have a sp which calculate price ,after restarting the sql server , I run this sp it is execution time is 3 sec.

    After a period of time,exec time is longer than 30 sec.

    If I recompile procedure,running time drops again 3 sec..

    Do you have any idea about this problem?

    Thanks a lot..

  • Could be a lot of things. Parameter sniffing? Statistics out of date?

    Have you tried profiling the procedure at statement level, including the actual execution plan?

    -- Gianluca Sartori

  • Yes,the execution plans are the same all time..

    but some of table statistics are not run..

  • Are you running with a different parameter set? It could be parameter sniffing.

    -- Gianluca Sartori

  • No,I run the same parameters

  • It doesn't make any sense that the time would vary, a recompile fixes the time, but you're looking at identical execution plans. Based on the situation you describe, the exec plans must be different. Look closer at them, at some of the details. It must be varying.

    The only other thing I can think of is resource contention. Have you looked to see if the process is being blocked when it's running long?

    "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

  • Can you post the execution plan?

    -- Gianluca Sartori

  • Sorry,I cant post execution plan.is the problem related with plan cache?

  • pektas.isil (1/26/2011)


    Sorry,I cant post execution plan.is the problem related with plan cache?

    I don't think so, since you said the plan is correct.

    I suggest that you identify with a trace which statement of the procedure takes longer and try to investigate that part alone.

    -- Gianluca Sartori

  • Ok,thank you.I will try

Viewing 10 posts - 1 through 9 (of 9 total)

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