queries behind missing index

When the DMVs suggest an missing index, is it possible to retrieve the query behind this, that the missing index suggestion is based on, through DMV caching .

thanks
LVL 6
anushahannaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chapmandewCommented:
You can't tell the queries that are missing the indexes.  you can tell the objects, but not the queries.  So, you could find the objects, and then would need to go find the queries/statements that use those objects and  go from there.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Aneesh RetnakaranDatabase AdministratorCommented:
this feature is not so smart as the database tuning advisor, i dont really think it is possible to retrieve the queries for which it created these indexes
0
anushahannaAuthor Commented:
so profiler is the only choice to get that info, right?
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

anushahannaAuthor Commented:
if profiler only, can you recommend the events that will help narrow the query.

thanks
0
Raja Jegan RSQL Server DBA & Architect, EE Solution GuideCommented:
Use profiler to catch the queries that takes high CPU time or Reads and Writes..
You can easily correlate these set of queries with the missing index detail in sys.dm_db_missing_index_details DMV.

And you can also correlate those queries using the approach mentioned below to create indexes on your own..

http://msdn.microsoft.com/en-us/library/ms345405.aspx

Hope this answers..

Note: while running Profiler, make sure that you run your application under heavy load so that you can identify the potential queries that needs to be tuned.
0
anushahannaAuthor Commented:
would you recommend just using filters for the index recommended columns, to restrict just them? and see which of them have high CPU, Reads etc.

Thanks for the idea of writing "CREATE INDEX Statements"
0
chapmandewCommented:
>>would you recommend just using filters for the index recommended columns, to restrict just them?

not sure what you mean?
0
anushahannaAuthor Commented:
Jegan was recommending catching queries with high cost. I already have an idea of what I want to look at through the profiler - the index columns the DMVs are recommending. I was asking him if it would suffice to look for transactions with those specific columns, for my purpose.

thanks Tim
0
Raja Jegan RSQL Server DBA & Architect, EE Solution GuideCommented:
>> would you recommend just using filters for the index recommended columns, to restrict just them? and see which of them have high CPU, Reads etc.

Let me explain more in detail

* Run profiler and catch the queries with High CPU, Reads and Writes
* Execute those queries in SSMS now after running

DBCC FREEPROCCACHE
DBCC DROPCLEANBUFFERS

* Now run the sys.dm_db_missing_index_details DMV to find out missing index info

Hope this is more clear.
0
anushahannaAuthor Commented:
what is the purpose of running the DBCC commands? Does it clear out the DMV values?

thanks
0
chapmandewCommented:
they clear the procedure cache...the purpose is so that you're running the queries with the same conditions...that one doesn't run faster than the other because the first is cached.
0
anushahannaAuthor Commented:
Thanks very much, Experts.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.