Search code examples
sessiontarget

SQL Server always running query every hour


I've been trying to figure out why sql server is always running this query every hour of the day.

 SELECT target_data FROM sys.dm_xe_session_targets xet WITH(nolock) JOIN sys.dm_xe_sessions xes WITH(nolock) ON xes.address = xet.event_session_address WHERE xes.name = 'telemetry_xevents' AND xet.target_name = 'ring_buffer'

Please explain if you have the knowledge about above. Much appreciated.


Solution

  • I found myself here when googling the same query. This was the highest total CPU query on our prod servers. I found it was running every 5 minutes. After digging into a few false trails (as we have a lot of monitoring stuff running), I finally just ran a trace and found the culprit. Trace of error

    A quick google easily found the answer from here - it is SQL Server Telemetry Service - which no longer became an option to disable on instance install from SQL 2016.

    There are posts on how to remove it, but I found simlpy doing it via the GUI (SQL Server 201* Error and Usage Reporting) was the easiest way and updated the registery correctly.