In Episode 3 of Cloud Cover, I mentioned the tip of the week was how to measure your database size in SQL Azure. Here is the exact queries you can run to do it:
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 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
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 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
The first one will give you the size of your database in MB and the second one will do the same, but break it out for each object in your database.
Hat tip to David Robinson and Tony Petrossian on the SQL Azure team for the query.
Comments [0] March 4, 2010
This is the personal site of Ryan Dunn, co-author of the The .NET Developers Guide to Directory Services Programming.
Ryan currently works for Microsoft and is the Technical Evangelist for Windows Azure
Buy the Book
Contact Ryan