﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / SQL Server 2005 General Discussion  / Same SQL statement executed with Different duration / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 07:17:39 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Same SQL statement executed with Different duration</title><link>http://www.sqlservercentral.com/Forums/Topic819261-149-1.aspx</link><description>Its a massive subject,  places to look are the estimated and the actual query plans,  use profiler to see actually whats running on SQL,  use perfmon to look at the server and see if anythings slowing down - cpu,  buffer io, memory etc,  use sp_who2 to see if there are locks knocking about,  make sure the stats and indexes are up to date (make sure the tipping point of the index isn't being compromised).   If you are using 2005 use the Performance Management download from MS.   It contains a whole load of reports and stuff to have a look at.    And dont forget the basics,   well written SQL,  simply coded looking at tables with minimal complexity will always perform better and more consistently than monsters!</description><pubDate>Thu, 15 Apr 2010 14:19:43 GMT</pubDate><dc:creator>Paul Swinfield</dc:creator></item><item><title>RE: Same SQL statement executed with Different duration</title><link>http://www.sqlservercentral.com/Forums/Topic819261-149-1.aspx</link><description>Thanks Lynn</description><pubDate>Tue, 17 Nov 2009 01:44:40 GMT</pubDate><dc:creator>Mayur-1130810</dc:creator></item><item><title>RE: Same SQL statement executed with Different duration</title><link>http://www.sqlservercentral.com/Forums/Topic819261-149-1.aspx</link><description>Without seeing the code not much we can do to help.  It is possible that you are experiencing parameter sniffing.Please read the first two articles I reference in my signature block below.  Following the instructions in those articles will help you get much better help.</description><pubDate>Mon, 16 Nov 2009 06:59:09 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: Same SQL statement executed with Different duration</title><link>http://www.sqlservercentral.com/Forums/Topic819261-149-1.aspx</link><description>Hi Paul,Thank you,Actully i am facing this problem to all store procedue(Same store procedure with different parameters value), 'Select' statement and view.</description><pubDate>Mon, 16 Nov 2009 03:01:03 GMT</pubDate><dc:creator>Mayur-1130810</dc:creator></item><item><title>RE: Same SQL statement executed with Different duration</title><link>http://www.sqlservercentral.com/Forums/Topic819261-149-1.aspx</link><description>You haven't really given us much information to work with, so I'll guess:In broad terms, SQL Server stores a query plan for the whole stored procedure.  That plan will be tuned according to the values passed to the procedure as parameters the first time it is executed.  If those particular parameter values are not typical, the server might store a plan which doesn't work as well when executed with different parameters.  Google 'SQL Server parameter sniffing' more more information.Alternatively, post some more details to get better answers.</description><pubDate>Mon, 16 Nov 2009 02:45:30 GMT</pubDate><dc:creator>Paul White</dc:creator></item><item><title>Same SQL statement executed with Different duration</title><link>http://www.sqlservercentral.com/Forums/Topic819261-149-1.aspx</link><description>Hi,I have one stand alone application which is using 'SQL Server 2005' as database.I have some tables containing records around 50,000. Those tables are executed using Store procedures and Views.In Database, Every time same store procedure takes different duration to execute (I have tracked time using SQL server profiler.).  Several times same store procedure executed within 1 second or some time it takes 2 to 3 second. It is impacting application performance.Can anyone tell me what could be reason behind different execution time each time for same store procedure? How could I improve performance of database?</description><pubDate>Mon, 16 Nov 2009 02:38:28 GMT</pubDate><dc:creator>Mayur-1130810</dc:creator></item></channel></rss>