SALES: 1-800-867-1380

Azure SQL Database Size Calculation

Updated: April 24, 2014

Microsoft Azure SQL Database samples the size of your SQL database periodically. Currently, database size samples are taken each hour. The frequency of database size samples may change over time.

ImportantImportant
This information is used to determine your monthly bill for only Web and Business editions. Also, size is the only meter used to bill Web and Business edition databases. For all other editions, the pricing structure is different. For more information see SQL Database Pricing Details.

For more information about editions, see Azure SQL Database Service Tiers (Editions).

Determining Database Size for a Single Point in Time

Size is defined in number of bytes, and is calculated as (number of allocated pages)*(8 KB) where 8 KB is the SQL page size. Allocated pages are those that have some non-deleted data on them, and include both user-created data and system metadata structures for that data. For more background on SQL page architecture, see Pages and Extents Architecture.

Azure SQL Database computes the number of allocated pages using an operation similar to the following.

SELECT SUM(reserved_page_count)
FROM sys.dm_db_partition_stats

Note that the results returned by this select statement are not identical to the size calculated by Azure SQL Database, because it does not include all metadata structures in the database.

Database Copies Are of Variable Size

In order to provide the Microsoft Azure service availability guarantee (SLA), Azure SQL Database maintains several active copies of each database, including backup copies. Database size is sampled from only one of those copies. The copy sampled to determine database size may change over time due to hardware and software failures, upgrades, and other factors. The size of each copy may be different due to differences in data on pages. This means the size reported in the portal - or from a REST or PowerShell API - and the size used to calculate your bill can vary even if no modifications to the database occur by any user.

Log Files

Azure SQL Database does not include the size of the log file used by a database. In the future, this may change.

See Also

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft