Sql-server – What does the Perfmon counter “Suboptimal plans/sec” actually measure

sql server

In SQL Server, what does the Perfmon counter "Workload Group Stats:Suboptimal plans/sec" measure?

It's one of the Resource Governor counters, so it's measured at the workload group (which you have whether you configure RG or not.)

I'm not asking what makes a good plan or a bad plan, but what specifically does that counter measure, and where do you go to find the exact corresponding plans? For example, I can't find anything in Extended Events that would seem to match to a query triggering the "Suboptimal plans/sec" counter.

Best Answer

There are two items this counter tracks:

  1. Timeout
  2. Memory Limit Exceeded

The values can be found in the XML plan as Max has proposed in the comments. I can confirm it has been this way since at least SQL Server 2008.

Kudos to @Max Vernon and @Joe Obbish.

The MSDN BOL Technet Docs description isn't super helpful.