Wednesday, March 7, 2012

cache of stored procedure

Dear sir,
On one of my page, it often reach a connection time out for the first hit.
After the first hit, that page will be much faster for the second visitor.
However after a while, that page back to original situation, waiting for the
first hit to make it faster.
I think this is because SQL server cache the execution plan after first hit.
Is it possible to make SQL server always cache this execution plan, so that
this page will always be that faster.
Thanks in advanced for your help!!!
regards,
Guoqi Zheng
http://www.ureader.comThis is a multi-part message in MIME format.
--090108040303080105030104
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
SQL Server will reuse cached plans whenever it can but sometimes it
needs to recalculate a given plan. It's a fairly complicated area with
many possible scenarios. If you want to know more about query plan
caching and reuse read this whitepaper (it's much better than any
summary I could give):
Batch Compilation, Recompilation, and Plan Caching Issues in SQL Server
2005 <http://www.microsoft.com/technet/prodtechnol/sql/2005/recomp.mspx>
It deals specifically with SQL 2005 but most of it (the theory at least)
applies to SQL 2000 as well.
--
*mike hodgson*
http://sqlnerd.blogspot.com
guoqi zheng wrote:
>Dear sir,
>On one of my page, it often reach a connection time out for the first hit.
>After the first hit, that page will be much faster for the second visitor.
>However after a while, that page back to original situation, waiting for the
>first hit to make it faster.
>I think this is because SQL server cache the execution plan after first hit.
>Is it possible to make SQL server always cache this execution plan, so that
>this page will always be that faster.
>Thanks in advanced for your help!!!
>regards,
>Guoqi Zheng
>http://www.ureader.com
>
--090108040303080105030104
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>SQL Server will reuse cached plans whenever it can but sometimes it
needs to recalculate a given plan. It's a fairly complicated area with
many possible scenarios. If you want to know more about query plan
caching and reuse read this whitepaper (it's much better than any
summary I could give):<br>
<a
href="http://links.10026.com/?link=Batch">http://www.microsoft.com/technet/prodtechnol/sql/2005/recomp.mspx">Batch
Compilation, Recompilation, and Plan Caching Issues in SQL Server 2005</a><br>
<br>
It deals specifically with SQL 2005 but most of it (the theory at
least) applies to SQL 2000 as well.<br>
</tt>
<div class="moz-signature">
<title></title>
<meta http-equiv="Content-Type" content="text/html; ">
<p><span lang="en-au"><font face="Tahoma" size="2">--<br>
</font></span> <b><span lang="en-au"><font face="Tahoma" size="2">mike
hodgson</font></span></b><span lang="en-au"><br>
<font face="Tahoma" size="2"><a href="http://links.10026.com/?link=http://sqlnerd.blogspot.com</a></font></span>">http://sqlnerd.blogspot.com">http://sqlnerd.blogspot.com</a></font></span>
</p>
</div>
<br>
<br>
guoqi zheng wrote:
<blockquote cite="mid39df9ec02c4f47be9549968bbbcfc257@.ureader.com"
type="cite">
<pre wrap="">Dear sir,
On one of my page, it often reach a connection time out for the first hit.
After the first hit, that page will be much faster for the second visitor.
However after a while, that page back to original situation, waiting for the
first hit to make it faster.
I think this is because SQL server cache the execution plan after first hit.
Is it possible to make SQL server always cache this execution plan, so that
this page will always be that faster.
Thanks in advanced for your help!!!
regards,
Guoqi Zheng
<a class="moz-txt-link-freetext" href="http://links.10026.com/?link=http://www.ureader.com</a>">http://www.ureader.com">http://www.ureader.com</a>
</pre>
</blockquote>
</body>
</html>
--090108040303080105030104--

No comments:

Post a Comment