SQL Azure provides us the following system view “sys.database_usage”to get the details of database quantity used per day
How to calculate Daily Cost Usage ?
1: /* How to calculate Daily Cost of DB Usage */
2:
3: SELECT time, sku, quantity,
4: CASE sku
5: when 'Web' THEN Quantity * (9.99 / 30)
6: WHEN 'Business' THEN Quantity * (49.99 / 30)
7: END AS DailyCostofDB
8: FROM sys.database_usage order by time
How to calculate Monthly cost of Database Usage ?
1: /* How to calculate Monthly Cost of DB Usage */
2:
3: SELECT CAST(datepart(yy, TIME) AS Varchar) + ' - ' + DateName(mm, TIME) [Billing Month],
4: SKU,
5: SUM ( CASE WHEN USAGE.SKU = 'Web'
6: THEN (Quantity * 9.99/30)
7: WHEN USAGE.SKU = 'Business'
8: THEN (Quantity * 99.99/30)
9: END ) AS CostInDollars
10: FROM sys.Database_Usage USAGE
11: GROUP BY CAST(datepart(yy, TIME) AS Varchar) + ' - ' + DateName(mm, TIME), SKU
12: ORDER BY CAST(datepart(yy, TIME) AS Varchar) + ' - ' + DateName(mm, TIME)
13:
You can use this queries in a SSIS Package to collect data from SQL Azure on daily basis and store it in local server and prepare reports across various different SQL Azure servers
I hope you all find this useful to monitor the cost of SQL Azure database usage
Does this still hold true? I think the costs have changed since you wrote this (not sure)?
LikeLike
Hi Mark,
The pricing structure has changed a lot since I wrote this post, Please refer this article for updated information http://msdn.microsoft.com/en-us/library/windowsazure/jj136829
Warm Regards
Arunraj
LikeLike