Sql-server – Why “Data File(s) Used Size (KB)” PerfMon counter doesn’t exist

perfmonsql serversql-server-2016

I wanted to create my own SQL Server baseline by collecting data with the Performance Monitor.

Among all counters that I have decided to monitor, I also wanted to have a historic trend about data file(s) growth for each database, but, unfortunately, there's no counter for that. I only have a "Data File(s) Size (KB)" counter, but that refers to the space that the database takes in advance, not the one that is actually using.

I know already that i can get the actual used size by doing some queries, in fact my question is not about how to retrieve that information but why can't i get it from the PerfMon.

Is there any official motivation for that? Laziness from Microsoft developers, some technical problem, or maybe something else?

Also note that I can get with no problem the used size for the log(s) file, which is kind of funny in my opinion!

Missing counter

Best Answer

While it probably doesn't really answer your question I'll post it anyway, it may be more of a comment though.

I don't think anybody outside of Microsoft can give us a definitive reason why this counter was never added.

There is only minor feedback on this connect item asking for a similar thing, but it hasn't been closed as wontfix either:

"Percent Data Used" Performance Counter - by AussieJohn in which Microsoft's last suggestion is:

Bill: thanks for the suggestion. sp_spaceused provides this information and much more. Do you want to expose all or a subset of the following info in perfmon?

  1. space reserved
  2. space allocated
  3. unused space that is reseved but not used
  4. space allocation between index and data

If you really want to expose this information through perfmon you could look at user settable counters as suggested by Marian in this answer