We have noticed an odd issue on two servers in a 3 node SQL Server 2017 cluster running Always On Availability Groups.

When checking the DMV sys.dm_os_performance_counters the row counts are totally out showing 4billion+ rows. It's just a single instance, a very heavy utilised server but only the one.

It does seem to correct itself after a reboot.

This can cause bad plans if we join this DMV with others. The original code was from SQLWatch and it was running a union all against the DMV which caused a large mem grant. It was also joining the data to internal SQLWatch tables. We got around the issue by dumping the dmv data into a temp table and querying that instead.

Has anyone else experienced this?

The code I am running is:

SELECT * FROM sys.dm_os_performance_counters

execution plan properties

estimated execution plan

  • Sounds like something worth reaching directly out to Microsoft about. Jun 27, 2022 at 17:07
  • Hi John, yes that's a next stop. We rebooted the server and the estimates reverted back, which we have seen before. We are going to log the info a table just to track and see if there is an event that happens before the estimates go out of synch
    – Stockburn
    Jun 28, 2022 at 4:31


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.