Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

queries behind missing index

Posted on 2010-01-12
12
Medium Priority
?
254 Views
Last Modified: 2012-05-08
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
0
Comment
Question by:anushahanna
  • 6
  • 3
  • 2
  • +1
12 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 800 total points
ID: 26294350
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
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 400 total points
ID: 26294422
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
 
LVL 6

Author Comment

by:anushahanna
ID: 26296309
so profiler is the only choice to get that info, right?
0
Free recovery tool for Microsoft Active Directory

Veeam Explorer for Microsoft Active Directory provides fast and reliable object-level recovery for Active Directory from a single-pass, agentless backup or storage snapshot — without the need to restore an entire virtual machine or use third-party tools.

 
LVL 6

Author Comment

by:anushahanna
ID: 26296481
if profiler only, can you recommend the events that will help narrow the query.

thanks
0
 
LVL 57

Assisted Solution

by:Raja Jegan R
Raja Jegan R earned 800 total points
ID: 26397634
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
 
LVL 6

Author Comment

by:anushahanna
ID: 26399748
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
 
LVL 60

Expert Comment

by:chapmandew
ID: 26399766
>>would you recommend just using filters for the index recommended columns, to restrict just them?

not sure what you mean?
0
 
LVL 6

Author Comment

by:anushahanna
ID: 26399883
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
 
LVL 57

Assisted Solution

by:Raja Jegan R
Raja Jegan R earned 800 total points
ID: 26400550
>> 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
 
LVL 6

Author Comment

by:anushahanna
ID: 26400974
what is the purpose of running the DBCC commands? Does it clear out the DMV values?

thanks
0
 
LVL 60

Assisted Solution

by:chapmandew
chapmandew earned 800 total points
ID: 26400999
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
 
LVL 6

Author Comment

by:anushahanna
ID: 26442417
Thanks very much, Experts.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Integration Management Part 2

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question