Tuesday, December 19, 2017

SQL SERVER - How to measure size of DB or table

Use this stored procedure:
use framework;
exec sp_spaceused;
Output:
database_name                         database_size      unallocated space
------------------------------------- ------------------ ------------------
framework                             7.50 MB            0.94 MB

reserved           data               index_size         unused
------------------ ------------------ ------------------ ------------------
5184 KB            2816 KB            1808 KB            560 KB
For question to concrete table add its name as parameter:
use framework;
exec sp_spaceused 'users';
Output:
name   rows        reserved           data               index_size         unused
------ ----------- ------------------ ------------------ ------------------ ------
users  40          16 KB              8 KB               8 KB               0 KB

No comments:

Post a Comment