473,779 Members | 2,089 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Prepared SQL Plan vs. Procedure Plan

I am working on tuning the procedure cache hit ratio for my server. We have
added 4 Gb of memory to the server, which has helped. In addition, I have run
the DBCC FREEPROCACHE, which helped for a couple of days to get the hit ratio
up to about 84% (from 68%).

When I use the performance monitor on the server and look at SQL Server Cache
Manager:Buffer Hit Ratio, I see that the Prepared SQL Plan is around 97%, but
the Procedure Plan hit ratio is down around 55%. I've done some research on
different tuning techniques, but can't seem to find 1. a clear definition of
the difference between the prepared sql plan and the procedure plan and 2.
other than adding memory and running dbcc freeprocache, how can I get the
procedure plan cache raised? I do know that there are some procedures that
need to be modified to be called fully qualified (e.g. exec dbo.sp_###
instead of exec sp_###), but I don't think that those will increase the
procedure plan by 30% or more.

Any insight you can give would be greatly appreciated.

Thanks,
Michael

--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums...neral/200511/1
Nov 23 '05 #1
1 2602
Michael G via SQLMonster.com (u13012@uwe) writes:
I am working on tuning the procedure cache hit ratio for my server. We
have added 4 Gb of memory to the server, which has helped. In addition,
I have run the DBCC FREEPROCACHE, which helped for a couple of days to
get the hit ratio up to about 84% (from 68%).

When I use the performance monitor on the server and look at SQL Server
Cache Manager:Buffer Hit Ratio, I see that the Prepared SQL Plan is
around 97%, but the Procedure Plan hit ratio is down around 55%. I've
done some research on different tuning techniques, but can't seem to
find 1. a clear definition of the difference between the prepared sql
plan and the procedure plan and 2. other than adding memory and running
dbcc freeprocache, how can I get the procedure plan cache raised? I do
know that there are some procedures that need to be modified to be
called fully qualified (e.g. exec dbo.sp_### instead of exec sp_###),
but I don't think that those will increase the procedure plan by 30% or
more.


It sounds like you have one or more application that is spewing out a
lot of dynamic SQL queries. Short of rewriting the applications there
is not much to do about that.

Note that if your applications mainly use stored procedures, that you
probably can get a lot of prepared things, if the procedure are called
with EXEC statements rather than the RPC mechanism.

I'm not really sure that I see the point with FREEPROCCACHE. Sure, it
removes old junk from the cache, but then it forces a lots of recompiles
to bring things bad.

If you stored procedures are really named sp_xxx, change that to something
else. The sp_ prefix is reserved for system objects, and SQL Server first
looks in master for these.

The best way to improve the cache hit ratio, is to find those queries
that pushes things out of the cache, because they unnecessarily scan
large tables.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2021
by: Vinny | last post by:
Can anyone help me with this strange problem please? I have a stored procedure, with a parameter defined as a uniqueidentifier. The procedure does a select with a number of joins, and filters within the Where clause using this parameter. (@orderHeader_id uniqueidentifier) SELECT *
8
9292
by: No one | last post by:
I am trying to create a prepared statement in ASP, but am having problems with creating the parameter object. I do the following Set fnParam = peopleUpdate.CreateParameter("@firstname", adVarChar, adParamInput, 50, peopleSourceRS("firstname")) But this gives the following error on the browser: Error Type: ADODB.Command (0x800A0BB9)
6
2106
by: tracy | last post by:
I have a complex query (16 table join) that until five days ago took 30 sec to run. It now takes eight hours. I restored a backup of the database from five days ago and the query plans are completely different for the same exact query. Five days ago the final estimated row count is 1.6M now it is 1.7E+10 OUCH! The amount of data added in those five days is insignificant (percentage wise). I rebuilt all the indexes using DBCC DBREINDEX...
1
1531
by: Chris Smith | last post by:
I've just noticed in the regular profiling information from our web application that a particular query on a fairly small database is taking about 15 seconds. The query is generated from software on the fly, hence its quirkiness -- if any of that is the problem, then I'll go ahead and fix it, but I can't imagine a few repeated WHERE conditions fooling the query optimizer. Anyway, I don't know how to interpret query plans. Can anyone...
2
2401
by: Adam Rogas | last post by:
I have a couple of complex stored procedures that work well and quickly once they have compiled. The problem I am running into is that every once in a while they want to refresh thier execution plans, and when that happens it takes about 1 minute and 30 seconds for them to rebuild, well of course my application is set up to time out commands after 30 seconds so basicly the stored procedure never completes and hangs up all of my subsequent...
5
4961
by: Dimitri Furman | last post by:
Using SQL Server 2000 SP4. There is a relatively complex stored procedure that usually completes in less than 20 seconds. Occasionally it times out after 180 seconds. The SP is called via ADO 2.8, using adCmdStoredProc command type. If I use Profiler to capture the EXEC that ADO sends to run the procedure, and run that from QA, the procedure completes in less than 20 seconds as it should. The procedure is created WITH RECOMPILE. One...
3
7317
by: birju | last post by:
Hi, I'm running SQL Profiler on an SQL Server 2000 database. I see that one stored procedure gets repeatedly executed having a handle of '1'. This query takes a long time to complete. How do I find what the text of the stored procedure is? I cant see any handle being created (using sp_prepare) with an id of '1' in the profiler. Is there any way to force the server to re-prepare all statements so that I can see the statement text and its...
3
6871
by: comp_databases_ms-sqlserver | last post by:
This post is related to SQL server 2000 and SQL Server 2005 all editions. Many of my stored procedures create temporary tables in the code. I want to find a way to find the query plan for these procs Repro --*********************************** use pubs go CREATE PROCEDURE Test @percentage int
4
6968
by: TheRealPawn | last post by:
I'm trying to get the execution plan for a single stored procedure from Profiler. Now, I've isolated the procedure but I get all execution plans. Any ideas on how to connect the SPIDs so that I only get the execution plan for the procedure I'm watching and not the whole of the server?
0
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10139
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9931
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6727
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5504
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.