spaceused
Spaceused refers to the SQL Server system stored procedure sp_spaceused, a tool for reporting how space is used within a database or a specific table. It is commonly used by database administrators to monitor growth, plan storage, and identify large objects that may affect performance or capacity.
When run without parameters, sp_spaceused returns database-level information, including database_name, database_size, and unallocated_space. When a table
- EXEC sp_spaceused 'dbo.YourTable';
- EXEC sp_spaceused @updateusage = 'TRUE';
- For a database: database_size indicates total allocated space, while unallocated_space shows free space within the database
- For a table: rows is the row count; reserved is total space allocated to the object; data
- Executing sp_spaceused generally requires membership in the db_owner fixed database role or equivalent permissions on the
- The procedure provides quick, practical insights but its numbers are estimates and can change with automated