sp_spaceused is one of the frequently used stored procedures when it comes to view the number of rows, reserved size, data size, index size, unused space in a table. I myself utilized it many a time.
Given below are the three methods to run sp_spaceused or equivalent for all tables in a database to get number of rows, reserved size, data size, index size, unused space but this time we will measure the performance as well.
Method 1 :
Given below is one line script that can achieve the required result but it will cost you a performance issue because it will loopall the tables in the database one by one and will give you the result set.
Given below is one of the server execution times.
SQL Server Execution Times:
CPU time = 203 ms, elapsed time = 1768 ms.
If you have more tables, it will give you the error…
View original post 217 more words