How to Reduce your Azure SQL Database Costs

Azure SQL Database provides a scalable database solution in the cloud, but with this scalability comes the opportunity for misconfiguration leading to greater than expected costs. In this post, I’ll explore various strategies to reduce your database costs, whilst hopefully also giving you a better understanding of some of the options available to you.

I’ll also cover cost-saving options like reviewing licensing models and optimising long-term backup retention.

This post is part of my Azure Cost-Saving Series. For more tips on reducing your Azure costs, check out the full series here: Sysadmin Central – Cost Saving Series.

Content

  1. DTU vs vCore Pricing
  2. Scaling Azure SQL Database to Optimise Costs
  3. Optimising Serverless Pricing for Intermittent Workloads
  4. Optimising Provisioned Pricing for Consistent Workloads
  5. Evaluate your Database Redundancy Configuration
  6. Monitoring and Optimizing SQL Costs
  7. Reducing Costs caused by Long-Term Retention of Backups
  8. Using Elastic Pools
  9. Reserved Capacity for Long-Term Savings
  10. Conclusion

DTU vs vCore Pricing

Azure SQL Databases offer two pricing models: DTU and vCore. Understanding which one suits your needs can lead to cost savings as both charge based on slightly differing factors and both may be the cheapest option in your specific use case.

DTU Model

This bundles compute, storage, and I/O into a fixed price based on the quantity of DTUs selected, which can be ideal for databases with predictable workloads. The Basic-tier can be as low as $6.11/month .

vCore Model

Provides flexibility by allowing you to independently scale compute and storage. It’s best for larger databases, workloads with variable resource demands and production uses.

The vCore model contains Provisioned and Serverless tiers.

Serverless is most useful for databases where the resource requirements may see spikes or large changes in requirements, as they’re able to automatically scale from 1-80 vCPUs depending on the current requirements. You also have the benefit of being able to configure Auto-pause delays wherby the server can effectively turn off if there is not activity at all, potentially saving significant costs.

Choosing the Right Model

  • Use the DTU model for smaller, predictable workloads with limited resource needs.
  • Choose the vCore model for more complex applications that require flexibility in scaling compute and storage or where Auto-pause is required.

Scaling Azure SQL Database to Optimise Costs

One of the simplest and most effective ways to save on Azure SQL Database costs is by adjusting your compute and storage.

Utilise the Metrics page available in Azure to verify the required resources (CPU, memory, storage) for your workloads and ensure that you’re not over-provisioning. Right-sizing based on your actual needs is key to cutting unnecessary costs.

Database Scaling
You can adjust the compute capacity (vCores or DTUs) based on your requirements quickly and easily via the Compute + Storage pane. Although the process is quick, please be aware that this is a disruptive operation which may lead to transactions being rolled back.

The process to scale a Database is as follows –

  1. In the Azure Portal, go to your SQL Database.
  2. Navigate to Compute + Storage and adjust the pricing tier and compute size.
  3. Save the changes to apply the scaling.

Optimising Serverless Pricing for Intermittent Workloads

An example of the Serverless Compute tier configuration

The Serverless Compute tier allows the database to automatically scale compute resources based on workload needs and can be configured to pause the the database entirely if not in use. You are only billed for active usage. The primary disadvantage to serverless is that it is not possible to utilise existing SQL Server Licences, nor to apply reservations.

Serverless also allows for a more limited range of Hardware Configurations than Provisioned, which may be a concern for large deployments.

How to Configure Serverless

  1. In the Azure Portal, go to your SQL Database.
  2. Under Compute + Storage, select one of the vCore-based purchasing models found under Service Tier.
  3. Select the Serverless Compute tier.
  4. Set the minimum and maximum vCores and configure the auto-pause delay if required, removing any associated compute costs during times when the database is paused. (Be careful using this as it can take significant time for the database to become active and the first several requests to it are likely to fail).
  5. Select Apply to save the new configuration.

Optimising Provisioned Pricing for Consistent Workloads

An example of the configuration available for Provisioned compute tier

The Provisioned Compute tier is designed to handle consistent workloads where performance is a key concern, allowing for up to 128 vCores and 625GB of dedicated memory on the default Standard-series Gen 5 configuration.

Provisioned tier deployments may also utilise Azure Hybrid Benefit-applicable SQL Server Licences, saving up to 34% on vCore costs and may also utilise Azure Reservations which can also lead to significant savings. However, provisioned tier databases are always online and may not use the Auto-Pause functionality found in the Serverless tier.

How to Configure Provisioned

  1. In the Azure Portal, go to your SQL Database.
  2. Under Compute + Storage, select one of the vCore-based purchasing models found under Service Tier.
  3. Select the Provisioned Compute tier.
  4. Select whether to utilise Azure Hybrid Benefit enabled SQL Server Licences.
  5. Set the provisioned number of vCores and the maximum data size.
  6. Select Apply to save the new configuration.

Evaluate your Database Redundancy Configuration

Geo-Replication allows you to create geographically redundant databases for disaster recovery by utilising availability zones, but this increases costs. For non-critical or low-priority workloads, consider disabling geo-replication to reduce costs.

Monitoring and Optimizing SQL Costs

Optimize Query Performance
Slow or inefficient queries can unnecessarily increase resource consumption. Regularly analyze query performance using SQL Query Performance Insights to optimize queries, minimizing compute resource usage and associated costs.

Review Backup and Storage Costs
Azure SQL Database handles backups automatically, but you can reduce costs by reviewing retention policies and storage settings. Use long-term backup retention (LTR) for compliance while placing older backups in cheaper storage tiers.

Automate Scaling with Azure Automation
For workloads with highly variable usage, consider using Azure Automation to automatically scale your database resources. This ensures resources are allocated only when needed, further reducing costs during off-peak times. Carefully consider what impact this may have on your implication however, as scaling databases is a potentially disruptive change.

Reducing Costs caused by Long-Term Retention of Backups

An example showing Retention Policies for an SQL Server

Longterm Retention may be configured at the SQL server level, allowing you to store backups for up to 10 years, but storing large quantities or long-term backups will impact the cost of the service.

Consider reducing the quantity of LTR backups being performed to reduce the associated backup data cost.

Using Elastic Pools

Elastic Pools allow multiple databases to share resources within a single pool. This is particularly useful for databases with varying usage patterns, where that usage does not coincide time-wise with the shared databases. A good example would be analysing several databases and finding that collectively they never hit 100 DTU’s, which may allow you to combine their compute resource at a vastly reduced price when compared to 20 individual servers each with their own required DTU count –

An example showing a basic analysis of 20 databases showing that they never collectively go past 100 DTUs

How to Set Up Elastic Pools

  1. In the Azure Portal, navigate to SQL Databases and create a new Elastic Pool.
  2. Add existing databases or create new ones within the pool.
  3. Configure the pool’s performance level (vCores or DTUs) based on the combined needs of the databases.

Reserved Capacity for Long-Term Savings

For consistent and long-term workloads, Reserved Capacity can lead to significant cost savings by allowing you to commit to a specific amount of compute resources for one or three years using Azure Reservations.

How Reserved Capacity Works
By committing to a set level of vCores, you can save up to 33% compared to pay-as-you-go pricing. This option is ideal for workloads with predictable usage patterns or where usage is expected to grow in future.

This is covered in some detail in the article below –

Conclusion

Hopefully some of the information here has been helpful and may even save you a few pounds, if there’s any of your own tips you’d like to add please don’t hesitate to comment below and I’d be happy to include them in the post for future readers.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Design a site like this with WordPress.com
Get started