Useful MS Sql command for table diskspace

Sometimes developers exist in a happy state of ignorance as to what is going on with their databases. Certainly, I can’t explain everything on this blog but I’ve found this statement to be useful on MS sql.

exec sp_spaceused [your table name]

This statement returns disk info about a particular table - recordcount, physical disk space taken by data and space reserved for this table’s data. It also returns similar info on indexes so that you can get an idea of how much resources they take. Its somewhat interesting to see the differences in how a simple index vs. clustered index use resources(well, if you are slightly bored).

Leave a Reply

You must be logged in to post a comment.