How to shrink Azure SQL server DB (18MB of data charged for 5GB of server space already)

Problem was caused by defragmented indexes.

You can find good scripts for fixing those from here: http://blogs.msdn.com/b/dilkushp/archive/2013/07/28/fragmentation-in-sql-azure.aspx

After running scripts (and 24h) size of DB went back to 300MB.


The bacpac file is going to be significantly smaller than the DB as it's a compressed version of the data and I believe it strips out things like index content and only stores index definitions which are reindexed on restore so one shouldn't be indicative of the other.

For example, I have a database on SQL Azure configured as a 10GB Premium DB, which is currently using 2.7GB, which BACPACs to about 300MB

What kind of database have you configured ? What Edition, Size and Usage settings are you currently being shown.

** Edit ** Image wasn't loading so here's the external link - http://i.snag.gy/JfsPk.jpg

The next thing to check is the size breakdown in the database by table/object. Connect to your Azure environment with Management Studio and run the following query. which will give a table breakdown of the database with sizes in MB.

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