SQL Server - Size summary

Returns summary of all data within SQL Server instance grouped by type. Tempdb database size excluded. Script can be handy during analyze of instance, disk drives sizing, memory sizing etc.

SELECT 
	type_desc AS DataType,
	CONVERT(DECIMAL(10,2),(SUM(size * 8.00) / 1024.00 / 1024.00)) As UsedSpace
FROM master.sys.master_files
WHERE name NOT LIKE 'temp%' 
GROUP BY type_desc

Results

Script results screen:

Results screen

Script results detailed description:

Column nameData typeDescription
DataTypenvarchar(60)Description of the file type: ROWS LOG FILESTREAM FULLTEXT (Full-text catalogs earlier than SQL Server 2008.)
UsedSpacefloatSpace used by given data in GB.

Leave a Reply