VB Magic

2012/02/27

Size matters (In SQL Azure)

Filed under: SQL, SQL Azure — Tags: , — vbmagic @ 11:45 am

I recently needed to look at table sizes in SQL azure. I had to work out what the biggest table sizes were and see if there is a way to make them smaller. After a bit of searching on the web, I came across this blog entry

http://dunnry.com/blog/CalculatingTheSizeOfYourSQLAzureDatabase.aspx

Which had this bit of SQL which worked really well.

select    
      sum(reserved_page_count) * 8.0 / 1024
from    
      sys.dm_db_partition_stats

GO

select    
      sys.objects.name, sum(reserved_page_count) * 8.0 / 1024 as S
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 order by S DESC

Jas

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

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

Blog at WordPress.com.

%d bloggers like this: