Catch up on the latest product updates, best practices, and expert insights from the Checkmk Conference #12 – Watch the livestream recordings now

Werk #19230: mk-sql: fix slow connections query

Component Checks & agents
Title mk-sql: fix slow connections query
Date Oct 15, 2026
Level Prominent Change
Class Bug Fix
Compatibility Incompatible - Manual interaction might be required
Checkmk versions & editions
3.0.0b1
Not yet released
Checkmk Community, Checkmk Pro, Checkmk Ultimate, Checkmk Cloud, Checkmk Ultimate MT

On instances with many databases, the query behind the MSSQL Connections services could run for minutes, which pushed the runtime of the mk-sql plug-in beyond the agent's plug-in timeout and left the services stale.

The query joined sys.databases to the deprecated compatibility view sys.sysprocesses and counted the rows after the join. Such a view carries no statistics, so SQL Server was free to rebuild it once per database.

This is a regression introduced with werk #18539, which replaced a correlated subquery with that join. Affected are 2.4.0p17 and newer, and all 2.5.0 releases.

The connections are now read from sys.dm_exec_sessions and counted before the join, which keeps the work proportional to the number of sessions instead of sessions times databases.

Consequences:

The reported numbers get smaller. sys.sysprocesses holds one row per execution context, so every request running in parallel contributed one row per worker thread. sys.dm_exec_sessions holds one row per session, which is what the service claims to show. Upper levels configured in the MSSQL Connections rule set should be reviewed, and the graphs show a step at the time of the update.

SQL Server 2008 and 2008 R2 have no sys.dm_exec_sessions.database_id, so these instances keep a query over sys.sysprocesses and keep their previous values. That query was reshaped the same way, so the long runtimes are gone on these versions as well.

To the list of all Werks