I don't think you can find this by an easy way but it is possible anyway to get through this. Profiler offers many event class types that can be used in analyzing the performance of a query. Start a new Profiler session and check following events:
Performance: Performance statistics
Stored Procedures: RPC:Completed
TSQL: SQL:BatchCompleted
TSQL: SQL: BatchStarting
Check to Show all columns and select each one of the columns under Performance: Performance statistics event only. The rest of events can be left with default setting.
Next, Select Column Filters and filter by DatabaseName and/or LoginName/ApplicationName/HostName etc.., if you know them. The purpose is to limit the number of rows dispalyed in Profiler and concentrate only on your needs.
Next, press Run and let it run for a while (2-3 min as long as you need).
Analyse the results dispalyed looking primarily at: Performance statistics event.
If Performance Statistics will occur often it means that the plan of a query was cached for the first time, compiled, re-compiled or evicted from PlanCache. From my knowledge if a query does not have its query plan in Plan Cache - you will see 2 rows of PerformanceStatistics event and followed by SQL:BatchStarting, then SQL:BatchCompleted. It means that the Query Plan was first compiled, cached and then the query started and completed.
Look at following columns under Performance Statistics event:
SPID - ID of the session on which the event occurred. You can use it to identify the
row on SQL:BatchCompleted event which will display the SQL Query text and other
usefull information (Read/Writes, StartTime/EndTime)
Duration - Total time, in microseconds, spent during compilation.
EventSubClass - 0 = New batch SQL text that is not currently present in the cache.
1 = Queries within a stored procedure have been compiled.
2 = Queries within an ad hoc SQL statement have been compiled.
3 = A cached query has been destroyed and the historical performance
data associated with the plan is about to be destroyed.
4 = A cached stored procedure has been removed from the cache and the
historical performance data associated with it is about to be
destroyed.
5 = A cached trigger has been removed from the cache and the historical
performance data associated with it is about to be destroyed.
Considering the EventSubClass number you can find out what happened with the Query Plan and take specific measures. Additionally you can add other columns to Stored Procedures and TSQL Event Classes if you are interseted in HostName, WindowsUser or other info from Profiler trace.
Also the trace can be stored in a SQL table making the analyse more easy and much more customizable. Here is a link describing more the Performance Statistics Event Class.
Not sure what you are seeing and not seeing in the event log but it works as expected for me (version 11.0.3000).
The mistake you did with your extra path expressions is that you forgot Stuff
in the path.
Testing this with the extended events and looking at the execution plan for operator Table Valued Function XML Reader ...
(there should be none), I found that one extra path is enough for your queries to make it use only the index to fetch the data [4] = '/Root/Stuff/Forms' as SQL nvarchar(25)
. You can have [3] = '/Root/Stuff/Forms' as XQUERY 'node()'
in there as well and perhaps it will make a difference or not depending on what your XML look like.
Note 1: You have mixed up the names of the columns in the index and your query. That might contribute to the problems you have with extended event.
Note 2: The events for missing selective XML indexes is generated when the query is compiled. If the query plan is used from the cache you will not see any events.
Best Answer
You can make use of the dmv's sys.dm_exec_query_stats and sys.dm_exec_requests to analyse the resource consuming queries along with their duration for what long:
Use the query below to capture the same:
Moreover would suggest if you are using extended events, you can capture the same. For more on how to set up and use the same, please read this whitepaper from Jonathan Using SQL Server 2008 Extended Events which should get you going alon with here
Also, when the queries run , and what all process run at the background and to check if blocking is really out there along with any particular waits , would suggest you to use SP_WHOISACTIVE from How to Use sp_WhoIsActive to Find Slow SQL Server Queries
Also, if you prefer to use Profiler you can track and troubleshoot the same as explained in How to Identify Slow Running Queries with SQL Profiler