bin/XEtemplates/Count Query Locks.xml
<event_sessions xmlns="http://schemas.microsoft.com/sqlserver/2008/07/extendedeventconfig">
<event_session name="Count Query Locks" maxMemory="4" eventRetentionMode="allowSingleEventLoss" trackCausality="true" dispatchLatency="30" maxEventSize="0" memoryPartitionMode="none"> <templateCategory> <!-- _locID_text="templateCategory" _locComment = "" -->Locks and Blocks</templateCategory> <templateName> <!-- _locID_text = "templateName" _locComment = "" -->Count Query Locks</templateName> <templateDescription> <!-- _locID_text = "templateDescription" _locComment = "" -->Counts the number of locks acquired by each query based on the query_hash value. You can use this template to identify the most lock intensive queries for investigation and tuning.</templateDescription> <event package="sqlserver" name="lock_acquired"> <action package="sqlserver" name="query_hash" /> <predicate> <and> <leaf> <comparator name="greater_than_uint64" package="package0"></comparator> <event name="lock_acquired" package="sqlserver" field="database_id"></event> <value>4</value> </leaf> <leaf> <comparator name="equal_boolean" package="package0"></comparator> <global name="is_system" package="sqlserver"></global> <value>false</value> </leaf> </and> </predicate> </event> <target package="package0" name="histogram"> <parameter name="filtering_event_name" value="sqlserver.lock_acquired" /> <parameter name="source" value="sqlserver.query_hash" /> </target> </event_session> </event_sessions> |