Stored proceture execute time diffrent time

  • calling in the application for sql command to run the stored procedure is always different varies so it sometimes takes about 100ms and then aiza 10ms, why is that. The stored procedure is just with saving the data is simple

  • Depends what the database is doing at the time. Requests get queued until the database can process the request, so sometimes it takes very little time, sometimes it takes more time. There are lots of things that can influence response time. One simple one is whether the data the query is requesting is cached already.

  • Where are you getting those execution times from?  From SQL Server or from the application?

  • Could be blocking. Could be resource contention. Could be differences in the amount of data returned. Could be changes in the execution plan caused by changes in parameter values and a recompile. Could be, oh, a whole bunch of stuff. Look at the execution plans when it runs slow & fast to look for differences. Capture wait statistics along with query statistics to see why a given execution is slow. Also, look for blocking and explore the blocking chain. Compare CPU & Logical reads when it's slow & fast to better understand what's happening.

    "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

  • This was removed by the editor as SPAM

  • This was removed by the editor as SPAM

Viewing 6 posts - 1 through 5 (of 5 total)

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