• RVO (11/4/2013)


    I compiled a stored procedure (UnitPricingTrans) 3 days ago.

    The first execution took 10 min.

    When I ran it second time it took 7 sec.

    All other runs on that day took from 7 to 11 seconds.

    Today I ran exactly the same procedure.

    It returns exactly the same number of rows (75).

    But it took 4 min.

    SQL Server was last restarted on October 16th.

    Today is November 4th.

    This is development server. Not too busy.

    I wonder why I have such huge inconsistency in terms of execution times.

    Thanks,

    Robert

    Not much in the way of details here. Are the stats current? Are you passing parameters to your proc, if so it might be parameter sniffing.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/