SQL Server Performance

How to query on Filegroup FREE SPACE

Discussion in 'SQL Server 2005 General DBA Questions' started by BikeBoy, Jun 8, 2008.

  1. BikeBoy New Member

    Hi all,
    I need to query on Filegroup free space rather than just a file free space. So, say I have a filegroup with 3 files, and need to know when this filegroup is filling up. I can find out about those files with the following t-sql:
    select physical_name FROM sys.database_files where data_space_id = (select data_space_id FROM sys.filegroups where name != 'primary');
    I am hoping that there's something easier than iterating through the files in each filegroup manually, and adding the free space.
  2. MohammedU New Member

    I don't think there is any other easy way...but you may need to join sys.data_spaces view with sys.database_files and do the group by on file group id...

Share This Page