473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Clearing up cache selectively

6
Hello everyone,

I have the following question:


I am aware that the objects currently in the cache can be viewed by issuing the following command:

SELECT *
FROM master.dbo.Syscacheobjects

Further, cache contents can be cleared by issuing the following command:

DBCC FREEPROCCACHE

However, I know that clearing cache using this command is not advisable, especially in production environment, as everything is cleared up (which would adversely affect performance of other stored procedures).

Is there a way to selectively clear things up? This selective clear up is always necessary when I am trying to find the true stored procedure performance.

I know that with tables we can use something called 'UNPINTABLE'. Is there something similar for stored procedures?

I tried the following command:

DELETE FROM master.dbo.Syscacheobjects
WHERE SQL = 'My_SP_Name'

but got the following error:

Msg 259, Level 16, State 2, Line 1
Ad hoc updates to system catalogs are not enabled. The system administrator must reconfigure SQL Server to allow this.


Is there another way of clearing specific data (stored procedure execution plans) from cache?

And if not, how exactly do I enable updates to system catalogs and what are the dangers associated with doing so?


Thanks a lot
Nov 20 '06 #1
3 2368
negmat
6
As I learned from another place, this can be achieved as such:

exec sp_recompile 'stored procedure name'
Nov 21 '06 #2
hjbs
1
Yes.. that's true!

But in case of Dynamic SQL.. does anyone knows how to avoid the ad-hoc queries to be stored in cache?

Thanks!
Jan 23 '07 #3
iburyak
1,017 Expert 512MB
Not sure if it is solution for you and don't know why you need this.
But try this:

[PHP]
Declare @SQL varchar(4000)
Set @SQL = 'Select * from some_table'

Execute (@SQL)[/PHP]

In this case text of select statement itself will not be compiled.
Jan 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Anubis Cain Dante | last post by:
I am trying to programmatically clear the forms and passwords in internet explorer. I am well aware of how to do this (via the UI) in Internet Options and I've already accomplished programmatically...
0
by: Michał Januszczyk | last post by:
is there any way to tell whether the application has entered the shutdown state ? I put some data into aspnet cache. Special callback method is specified that should be called when cache item is...
6
by: JJ_377 | last post by:
In a "Save and Quit" button on my web app form (aspx), I have the following code that is supposed to clear a session variable (an user id) and redirect to a logon page: Session.Clear()...
4
by: tarunbajaj | last post by:
Hi all, I am inserting a key in HttpContext.Cache Some keys I am caching for multiple days. Out of these once a while I need to reset cache entry of specific key. I can do a lot to reset the...
0
by: PD | last post by:
I am trying to stream out a PDF file via the response object and when I execute the code it always brings up the first document that I pulled up.Even when I step through the code, I can see the new...
1
by: Siva | last post by:
Hi, I have a 3 tier ASP.Net app for a handheld which needs to fetch orders from database via a DAL and populate it in a gridview using objectdatasource. In the search page I have a few parameters...
0
by: negmat | last post by:
Hello everyone, I have the following question: I am aware that the objects currently in the cache can be viewed by issuing the following command: SELECT * FROM master.dbo.Syscacheobjects ...
0
by: Nizha | last post by:
Hi, The browser cache is not getting clearing inspite of setting these headers.. <% response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 response.setHeader("Pragma","no-cache");...
1
by: David Lozzi | last post by:
Howdy, How do I forcibly clear out the cache for entire web application? I want to give my customer the option to clear the cache after any major data updates they may do. Thanks! David...
3
by: helveticus | last post by:
This really puzzles me. I have an application with a single style sheet (30KB) and a series of js files, all declared in the header section of the master page the standard way: <link...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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,...

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.