HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Parameters in Activity Monitor

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
activityparametersmonitor

Problem

To view "recent expensive queries" I use Activity Monitor. Some of the queries there are with parameters.

Is there a way to know the values?

Solution

You can right-click the query you are interested in and select Show execution plan:

Once you have the execution plan open, just right-click in an empty area and select Show Execution Plan XML.... Once you have that you will see a section in the XML `. In that node it will show you the ParameterCompiledValue:


      
      
    
  


Another way would be to copy the execution plan XML out and paste it into Plan Explorer and view the
Parameters tab:

Edit for the nerds

If you open up Activity Monitor, and then go into tempdb you will find all the temp objects (tables and all) that Activity Monitor is using. For the Expensive Queries it is using the object
dbo.#am_get_querystats`. You can open that procedure up and look at the exact query they use to pull it. Pretty cool. I did this for the activity section so I could get similar information without having to open up Activity Monitor all the time.

Code Snippets

<ParameterList>
      <ColumnReference Column="@records" ParameterCompiledValue="(0)" />
      <ColumnReference Column="@traceid" ParameterCompiledValue="(2)" />
    </ParameterList>
  </QueryPlan>
</StmtSimple>

Context

StackExchange Database Administrators Q#121044, answer score: 7

Revisions (0)

No revisions yet.