I am looking at ways to count rows in several tables on several databases. In this particular case I am looking for unused and abandoned items.
Several sources source1, source2 recommend using sys.dm_db_partition_stats everything agrees that the count is not perfectly accurate. MSDN describes row_count as
approximate number of rows in the partition.
I understand if the value is always changing, it might be off by a bit. There are some good arguments on why this small discrepancy really doesn't matter. But if the value is near zero or none, will it be accurate?
If I use sys.dm_db_partition_stats and I am getting no rows found, do I need to run a second query using COUNT (or something else) to make sure the table is really empty or is the inaccuracy limited to minor fluctuations over minor periods of time?
Clarify I don't own the data, so I am ethically prohibited from looking at it. If sys.dm_db_partition_stats tells me a table is empty I can't just go open it and see if it really is empty. I need to know if I can depend on the results returned from it. As pointed out in answers, more information than just this will be required, before deleting. The table may be used as a temp table, maybe it gets rows written to it and removed, and just always happens to be empty when I look at it.
If I use sys.dm_db_partition_stats and I am getting no rows found
then you are probably in the wrong database. If you mean therows
column shows 0, rather than "no rows found" - which implies that the DMV returned no rows for your table - please clarify.