question

Sagar Bhargava avatar image
Sagar Bhargava asked

Finding the Table Size

Is there is a way to find out the size of a table i.e know which is the biggest table in the database apart from doing a row count and deducing the size ?

spacemeta-dataexisting-table
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Rob Farley avatar image
Rob Farley answered

Try this:

SELECT object_name(object_id) as objectname, SUM(used_page_count) * 8192. / 1024 / 1024 as pages_used_MB
FROM sys.dm_db_partition_stats
GROUP BY object_id
ORDER BY SUM(used_page_count) DESC;
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Laerte Junior avatar image
Laerte Junior answered

I use this script : Monitoring Table Growth with PowerShell In fact it shows you the rate of growth existing in each table, at each database of each server. But in the TOTAL column you have the size of it with the sum of IndexSpaceUsed + DataSpaceUsed for each table

Actually for what you said, Rob has put the best way. I voted for him .. But If you want an automated routine and that will show you beyond the size, growth rate of each table..there is..and works fine...

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.