Home Forums Programming CLR Integration and Programming. CLR mountpoint freespace query scaling *really bad* with high number of mountpoints RE: CLR mountpoint freespace query scaling *really bad* with high number of mountpoints

  • Theo, I just found something that might help.

    Is it safe to say that you are only checking mount points where you currently have data and/or log files? These are the ones that you need to know if they are running out of space, right? As opposed to ALL mount points?

    If just the ones that have DB files on them, check out the sys.dm_os_volume_stats DMV (introduced in SQL Server 2008 R2).

    You can try the following query (assuming you are using SQL Server 2008 R2 or newer):

    SELECT files.*, '---' AS [---], stat.*

    FROM sys.[master_files] files

    CROSS APPLY sys.dm_os_volume_stats(files.[database_id], files.[file_id]) stat;

    SQL#https://SQLsharp.com/ ( SQLCLR library ofover 340 Functions and Procedures)
    Sql Quantum Lifthttps://SqlQuantumLift.com/ ( company )
    Sql Quantum Leaphttps://SqlQuantumLeap.com/ ( blog )
    Info sitesCollations     •     Module Signing     •     SQLCLR