SQL Database performance tuning in Azure is important even though you do not need to have a dedicated database administrator to manage or maintain databases. To get the best results, you may have to make updates to various aspects of your Azure SQL database environment. Microsoft provides a few ways for you in Azure to leverage and find out details about how your database is performing. A few of these are:
1) Extended Events
Initially introduced in SQL Server 2008, the extended events tool was made available on Azure SQL in 2015 and that too only on V12 Databases. This tool lets you get internal information of your database for advanced monitoring and also troubleshooting purposes. You can collect as little or as much data as needed to identify or troubleshoot any performance issues. The official Microsoft documentation provides more details on how to use extended events to improve performance issues.
2) Query Store
Available on V12 databases, using the query store lets you get performance insights on the historical telemetry data collected by Azure’s SQL service. You can review a list of the highest resource consuming queries carried out on your database. It is also possible to drill down further by selecting individual queries to view further details. In short, you get insights on the performance of the queries run on your database. The query store helps carry out performance troubleshooting by letting you find any performance differences due to changes in query plans.
3) DMV’s or Dynamic Management Views
You can monitor performance problems using Azure dynamic management views. Performance problems may arise due to poor query plans, resource bottlenecks, long-running or blocked queries, and so on. Azure partially supports three kinds of dynamic management:
– Database related DMV’s
– Execution related DMV’s
– Transaction related DMV’s
After reviewing the appropriate DMV’s, it is then possible to troubleshoot any performance issues that you come across.
4) Automatic Index Management
Azure SQL database offers automatic index management to manage database indexes without your intervention. It creates any missing indexes and also removes unused or duplicate indexes. The benefits that automatic index management provides are:
- a) Index recommendations can be extremely helpful to anybody managing SQL Server databases
- b) Any index recommendations are captured in a DMV to be reviewed. After review, it is possible to either implement or drop the recommendation.
5) Adaptive query processing
Azure provides adaptive query processing that automatically adapts optimization strategies to runtime conditions of your Azure SQL database’s application workload. There are currently three query processing features available in Azure:
– Batch mode memory grant feedback
Performance suffers if memory grant sizes are excessive or inadequate. Batch mode memory grant feedback is useful to recalculate the actual memory that a query requires and then update the grant value appropriately.
– Batch mode adaptive joins
This is an operator that dynamically switches between nested loop joins or hash joins. The threshold for switching is calculated for individual statements depending upon input data.
– Interleaved execution
Interleaved execution helps to fight cardinality issues caused by Multi-Statement-Table-Valued-Functions (MSTVF). During a query optimization phase, the compiler pauses on facing a candidate for interleaved execution. Subsequently, it executes a query subtree for the MSTVF. The compiler finally captures the correct cardinality estimation and resumes previously paused operations.
SQL Server performance tuning can be complicated, frustrating, and time-consuming. Data professionals use third-party performance tuning tools to help them diagnose, monitor, and optimize their database environment in a better manner. Such tools compliment built-in tools available with Azure to give you access to more in-depth historical data and baselines. Having access to this information helps you manage database workloads more efficiently.