Avatar of pae2
pae2Flag for United States of America asked on

detecting query recompilation / sql server 2008

I'm trying to detect if I have some queries that are recompiling for requests from different users opposed to using cache. Here's how I plan on doing that:

USE DB

GO
DBCC dropcleanbuffers
DBCC freeproccache

GO

SET STATISTICS TIME ON

GO

SELECT STATEMENT

GO

SELECT STATEMENT

I realize that this will provide parse/compile and execution time.

The problem is that when User-A executes a particular query, it's slow at first and then fast after subsequent requests. When User-B executes that very same query, it's also slow at first and then faster after subsequent requests.

Will the foregoing be able to tell me whether or not the query is recompiled for User-B after it has compiled for User-A?

Ideally, I'm hoping that it'll compile for User-A and then just reference the existing plan/cache for User-B.

Will existing indexes impact this analysis? Should I drop them?
Microsoft SQL Server 2008Microsoft SQL ServerMicrosoft SQL Server 2005

Avatar of undefined
Last Comment
Jim P.

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Kevin Cross

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
jogos

I hope you don't do the freecache/cleanbuffers on your production server. That is best only used on your local instance
Jim P.

I'm seeing your series of questions about monitoring performance. You may want to look at getting Confio's Ignite monitoring software. The free version gives you a fair amount of data like this.

http://www.confio.com/performance/sql-server/ignite/
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck