Welcome to MSDN Blogs Sign in | Join | Help

Conor vs. SQL

Conor Cunningham's blog on SQL Server, data-driven applications, and pretty much whatever other random stuff he decides to post.

Syndication

Conor vs. Recompiles

I have a question for you guys about how do you force a recompile for a single query today?

 

There are a lots of different ways that one could cause the system to recompile a query:

a) sp_recompile <object used in a query>

b)DBCC FREEPROCCACHE (with optional arguments to restrict the set of impacted queries)

c) detach/attach db (2008+), restart server, etc.

d) use a lot of memory to force plans out of memory

e) update statistics

f) change the text of the query (add a space), which works mostly except for trivial plans (which you may not care about recompiling anyways)

 

I am curious what other ways people use (or what you use most frequently).  If you have any interesting scenarios about how/why you recompile a plan, I’d like to hear about them, so please send them my way (conorc @ microsoft.com)

If you never have occasion to recompile queries or think it’s not useful, that’s fine too – I want to hear about those cases as well.

 

If there are some interesting cases, I’ll post them up anonymously if you don’t mind.

 

Thanks,

 

Conor

Published Monday, May 18, 2009 1:45 PM by Conor Cunningham [MSFT]

Comments

# Conor vs. Recompiles | Microsoft Share Point @ Monday, May 18, 2009 2:53 PM

PingBack from http://microsoft-sharepoint.simplynetdev.com/conor-vs-recompiles/

Conor vs. Recompiles | Microsoft Share Point

# re: Conor vs. Recompiles @ Sunday, May 24, 2009 12:47 PM

Cool!

I want to know them as well.

Please post them later^^

Jungsun Kim

SQL Server MVP

JungSun

Anonymous comments are disabled
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement  
Page view tracker