SQL Azure – Calculate Table Size

Useful post from Ryan Dunn on calculating table size.  Reprinted below:

-- Total DB Size
SELECT SUM(reserved_page_count) * 8.0 / 1024
FROM sys.dm_db_partition_stats;

-- Individual Table Sizes
SELECT sys.objects.name, SUM(reserved_page_count) * 8.0 / 1024
FROM sys.dm_db_partition_stats,
 sys.objects
WHERE sys.dm_db_partition_stats.object_id = sys.objects.object_id
GROUP BY sys.objects.name;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s