bin/XEtemplates/Overly Complex Queries.xml

<event_sessions xmlns="http://schemas.microsoft.com/sqlserver/2008/07/extendedeventsconfig">
   <event_session name="Overly Complex Queries" maxMemory="100" eventRetentionMode="allowSingleEventLoss" trackCausality="false" dispatchLatency="5" maxEventSize="0" memoryPartitionMode="none">
    <templateCategory>
      <!-- _locID_text="templateCategory" _locComment = "" -->Performance Store</templateCategory>
    <templateName>
      <!-- _locID_text = "templateName" _locComment = "" -->Overly Complex Queries</templateName>
    <templateDescription>
      <!-- _locID_text = "templateDescription" _locComment = "" -->Captures queries that report errors 16 and 8623. This generally means that the query was unnecessarily complex.</templateDescription>
      <event package="sqlserver" name="error_reported">
         <action package="sqlserver" name="client_app_name" />
         <action package="sqlserver" name="client_hostname" />
         <action package="sqlserver" name="client_pid" />
         <action package="sqlserver" name="database_id" />
         <action package="sqlserver" name="database_name" />
         <action package="sqlserver" name="nt_username" />
         <action package="sqlserver" name="plan_handle" />
         <action package="sqlserver" name="session_id" />
         <action package="sqlserver" name="sql_text" />
         <action package="sqlserver" name="transaction_id" />
         <action package="sqlserver" name="tsql_frame" />
         <action package="sqlserver" name="username" />
         <predicate>
            <and>
               <leaf>
                  <comparator name="equal_int64" package="package0" />
                  <event name="error_reported" package="sqlserver" field="severity" />
                  <value>16</value>
               </leaf>
               <leaf>
                  <comparator name="equal_int64" package="package0" />
                  <event name="error_reported" package="sqlserver" field="error_number" />
                  <value>8623</value>
               </leaf>
            </and>
         </predicate>
      </event>
      <target package="package0" name="event_file">
         <parameter name="filename" value="Overly Complex Queries" />
         <parameter name="max_file_size" value="200" />
         <parameter name="max_rollover_files" value="5" />
         <parameter name="metadatafile" value=" Overly Complex Queries.xem" />
      </target>
   </event_session>
</event_sessions>