microsoft / sqlmanagementobjects

Sql Management Objects, an API for scripting and managing SQL Server and Azure SQL Database
Other
132 stars 22 forks source link

The space available property is not computed correctly #147

Open deweter opened 1 year ago

deweter commented 1 year ago

The Database.SpaceAvailable property is not computed correctly. The reason for this issue is that the input used in the calculation of this property, as seen in the source code, relies on a join operation between the sys.allocation_units and sys.partitions DMVs. However, this inner join is incompatible with columnstore indexes, as clearly documented in the official documentation. Consequently, the size is inaccurately computed for databases using columnstores. The solution is straightforward: remove this incompatible join operation from the calculation.