How to check SQL Server Filegroup file sizes

02 November,2020 by Jack Vamvas

I had a question from a fellow DBA about how to list every file  per SQL Server filegroup , and report on the size in MB. This will give them a quick way of checking which file could be creating a capacity issue. 

Quite often , alerting is set up to check the whole drive , but won't check every file. So some granular report can identify the file causing a capacity issue 

--Return file , size in MB , filegroup 

SELECT sdf.name AS [File_Name],
sdf.size/128 AS [Size_MB],
fg.name AS [FileGroup_Name],
sdf.physical_name as [File_physical_name]
FROM sys.database_files sdf
INNER JOIN
sys.filegroups fg
ON sdf.data_space_id=fg.data_space_id

Read more on Filegroups

How to create a table in another FILEGROUP using SELECT INTO ...

Moving a Non Clustered Index to another filegroup ...

 


Author: Jack Vamvas (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to check SQL Server Filegroup file sizes


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer