SlideShare a Scribd company logo
Query Performance Tuning
in the Cloud
Start Grant Fritchey
Goals
Explain the importance of query tuning within the
Azure SQL Database environment.
Show how the hybrid tool set can be used to
identify poor performance.
Demonstrate the additional functionality available
within the Database Management Portal interface.
Get in touch
Grant Fritchey
scarydba.com
grant@scarydba.com
@gfritchey
Why Tune Queries?
You have no control over:
» Where your queries run
» How many resources your query uses
» How many CPUs/Disks are dedicated to you
» When the server is just going to go away
Most performance problems are code or
structure related
One query runs many places
Then Why Use SQL Database?
Speed of delivery
Extremely low
management cost
Cheap prices Expandable capacity
What’s Old is New
Transactions as short as possible
Only move the data you need to move
Only move the data when you need to move
it
Tune the queries
Checking on Throttling
Throttling
Master Database
» Sys.event_log
» Sys.database_connection_stats
Tools for Query Tuning
Query Tuning Tools
SQL Server Management Studio
SQL Database Management Portal
Dynamic Management Objects
Connectivity required
SQL Server Management Studio
Object Explorer
Query window
» And not much else
Statistics Time
Execution Plans
Statistics IO
Monitor
Query window Execution Plan
Statistics Time
SQL Database Management Portal
Statistics IO
Portal: Monitor
Connection Activity
» Including throttled connections
Cache dependent
Query Performance
» Aggregation
» Details
Execution plans
» Actual
» Estimated
Roughly same as SSMS query window
» No drag & drop for object names
» No code completion
Portal: Query Window
No properties
» SET STATISTICS IO/TIME ON/OFF
Graphical
Can be saved
Highlighting
Properties
Portal: Execution Plans
Reset on database move
» Not reboot, restart, attach, detach, etc.
Operating system information is gone
DMO Differences
No clickable execution plans
Expected wait types
» RESOURCE_SEMAPHORE
» *IO_LATCH
» SOS_SCHEDULER_YIELD
Special wait types
» SE_REPL_SLOW_SECONDARY_THROTTLE
» SE_REPL_COMMIT_ACK
sys.dm_exec_requests does show waits
sys.dm_db_wait_stats
Wait State Monitoring
Sys.dm_exec_requests
Sys.dm_exec_query_stats
Query DMOs
Sys.dm_exec_sql_text
Sys.dm_exec_query_plan
Sys.dm_exec_query_plan_text
Sys.dm_db_index_operational_stats
Sys.dm_db_index_physical_stats
Sys.dm_db_index_usage_stats
Index DMO
Goals
Explain the importance of query tuning within the
Azure SQL Database environment.
Show how the hybrid tool set can be used to
identify poor performance.
Demonstrate the additional functionality available
within the Database Management Portal interface.
Scarydba.com/resources
Resources
SQL Server 2012 Query Performance Tuning
by Grant Fritchey
Performance Tuning with SQL Server Dynamic
Management Views by Louis Davidson and Tim Ford
Windows Azure SQL Database and SQL Server –
Performance and Scalability Compared and Contrasted
Get in touch
Grant Fritchey
scarydba.com
grant@scarydba.com
@gfritchey

More Related Content

PDF
HUGIreland_CronanMcNamara_DataScience_ExpertModels.pdf
PDF
A Practical Enterprise Feature Store on Delta Lake
PPTX
How Kafka and Modern Databases Benefit Apps and Analytics
PPTX
GOTO Aarhus 2014: Making Enterprise Data Available in Real Time with elastics...
PDF
Converging Database Transactions and Analytics
PDF
HyperBatch
PPTX
Microsoft Azure Data Factory Hands-On Lab Overview Slides
PDF
Architecting Data in the AWS Ecosystem
HUGIreland_CronanMcNamara_DataScience_ExpertModels.pdf
A Practical Enterprise Feature Store on Delta Lake
How Kafka and Modern Databases Benefit Apps and Analytics
GOTO Aarhus 2014: Making Enterprise Data Available in Real Time with elastics...
Converging Database Transactions and Analytics
HyperBatch
Microsoft Azure Data Factory Hands-On Lab Overview Slides
Architecting Data in the AWS Ecosystem

What's hot (20)

PDF
Deliver Your Modern Data Warehouse (Microsoft Tech Summit Oslo 2018)
PPTX
Microsoft Data Integration Pipelines: Azure Data Factory and SSIS
PPTX
ETL in the Cloud With Microsoft Azure
PPTX
Five ways database modernization simplifies your data life
PPTX
Curriculum Associates Strata NYC 2017
PPTX
PowerStream Demo
PDF
Real-Time Forecasting at Scale using Delta Lake and Delta Caching
PDF
Azure saturday pn 2018
PDF
5 Amazing Reasons DBAs Need to Love Extended Events
PDF
Solving your Backup Needs - Ben Cefalo mdbe18
PPTX
Splunk What's New - Nov 2014
PPTX
Azure Data Factory for Redmond SQL PASS UG Sept 2018
PDF
Tools and Tips For Data Warehouse Developers (SQLGLA)
PPTX
Data & Analytics Forum: Moving Telcos to Real Time
PDF
Real-Time Analytics with Confluent and MemSQL
PPTX
Geek Sync I Learn to Troubleshoot Query Performance in Analysis Services
PDF
Leveraging Cloud for the Modern SQL Developer
PPTX
Microsoft Build 2018 Analytic Solutions with Azure Data Factory and Azure SQL...
PDF
ADF Mapping Data Flow Private Preview Migration
PPTX
BTUG - Dec 2014 - Hybrid Connectivity Options
Deliver Your Modern Data Warehouse (Microsoft Tech Summit Oslo 2018)
Microsoft Data Integration Pipelines: Azure Data Factory and SSIS
ETL in the Cloud With Microsoft Azure
Five ways database modernization simplifies your data life
Curriculum Associates Strata NYC 2017
PowerStream Demo
Real-Time Forecasting at Scale using Delta Lake and Delta Caching
Azure saturday pn 2018
5 Amazing Reasons DBAs Need to Love Extended Events
Solving your Backup Needs - Ben Cefalo mdbe18
Splunk What's New - Nov 2014
Azure Data Factory for Redmond SQL PASS UG Sept 2018
Tools and Tips For Data Warehouse Developers (SQLGLA)
Data & Analytics Forum: Moving Telcos to Real Time
Real-Time Analytics with Confluent and MemSQL
Geek Sync I Learn to Troubleshoot Query Performance in Analysis Services
Leveraging Cloud for the Modern SQL Developer
Microsoft Build 2018 Analytic Solutions with Azure Data Factory and Azure SQL...
ADF Mapping Data Flow Private Preview Migration
BTUG - Dec 2014 - Hybrid Connectivity Options
Ad

Similar to Grant Fritchey - Query Tuning In Azure SQL Database (20)

PDF
Practical SQL query monitoring and optimization
PPTX
NoSQL em Windows Azure Table Storage - Vitor Tomaz
PPTX
[NetPonto] NoSQL em Windows Azure Table Storage
PPTX
Query Store and live Query Statistics
PDF
Self-serve analytics journey at Celtra: Snowflake, Spark, and Databricks
PPTX
SQL Bits 2018 | Best practices for Power BI on implementation and monitoring
PDF
Best Practices for Building Robust Data Platform with Apache Spark and Delta
PPTX
Data Warehouse Testing in the Pharmaceutical Industry
PPTX
05_DP_300T00A_Optimize.pptx
PPT
Sql Server Performance Tuning
PPTX
Developing on SQL Azure
PPTX
New World Of SharePoint 2010 Administration Oleson
PPTX
Database Performance Tuning| Rahul Gulab Singh
PDF
What are you waiting for
PPTX
Cepta The Future of Data with Power BI
PPTX
SQL Server Integration Services and Analysis Services
PPTX
How we evolved data pipeline at Celtra and what we learned along the way
PPTX
Day 1 - Technical Bootcamp azure synapse analytics
PPTX
Why Standards-Based Drivers Offer Better API Integration
PPT
Asia Pacific SharePoint Capacity Planning by Joel Oleson
Practical SQL query monitoring and optimization
NoSQL em Windows Azure Table Storage - Vitor Tomaz
[NetPonto] NoSQL em Windows Azure Table Storage
Query Store and live Query Statistics
Self-serve analytics journey at Celtra: Snowflake, Spark, and Databricks
SQL Bits 2018 | Best practices for Power BI on implementation and monitoring
Best Practices for Building Robust Data Platform with Apache Spark and Delta
Data Warehouse Testing in the Pharmaceutical Industry
05_DP_300T00A_Optimize.pptx
Sql Server Performance Tuning
Developing on SQL Azure
New World Of SharePoint 2010 Administration Oleson
Database Performance Tuning| Rahul Gulab Singh
What are you waiting for
Cepta The Future of Data with Power BI
SQL Server Integration Services and Analysis Services
How we evolved data pipeline at Celtra and what we learned along the way
Day 1 - Technical Bootcamp azure synapse analytics
Why Standards-Based Drivers Offer Better API Integration
Asia Pacific SharePoint Capacity Planning by Joel Oleson
Ad

More from Red Gate Software (20)

PDF
The future of DevOps: fully left-shifted deployments with version control and...
PDF
Embracing DevOps through database migrations with Flyway
PPTX
Database DevOps for Managed Service Providers
PDF
Mizuho Financial: Launching our Database DevOps journey
PDF
7 steps to effective SQL Server monitoring
PDF
Level up your deployments for SQL Source Control
PDF
Key findings from the 2020 state of database dev ops report
PPTX
Extend DevOps to Your SQL Server Databases
PDF
2019 year in review slides
PPTX
What we learned at PASS Summit in 2019
PPTX
Quality in Software Development: Anglia Ruskin University
PPTX
How SQL Change Automation helps you deliver value faster
PPTX
DevOps essentials from Abel Wang and Steve Jones
PPTX
Successfully migrating existing databases to Azure
PPTX
The Ultimate Guide to Choosing and Implementing the Right Monitoring Tool
PDF
Everything You Need to Know About the 2019 DORA Accelerate State of DevOps Re...
PDF
Using Redgate, AKS and Azure to bring DevOps to your database
PDF
Using Redgate, AKS and Azure to bring DevOps to your Database
PDF
How to Pitch a Software Development Initiative and Ignite Culture Change
PDF
Taming the Wild West
The future of DevOps: fully left-shifted deployments with version control and...
Embracing DevOps through database migrations with Flyway
Database DevOps for Managed Service Providers
Mizuho Financial: Launching our Database DevOps journey
7 steps to effective SQL Server monitoring
Level up your deployments for SQL Source Control
Key findings from the 2020 state of database dev ops report
Extend DevOps to Your SQL Server Databases
2019 year in review slides
What we learned at PASS Summit in 2019
Quality in Software Development: Anglia Ruskin University
How SQL Change Automation helps you deliver value faster
DevOps essentials from Abel Wang and Steve Jones
Successfully migrating existing databases to Azure
The Ultimate Guide to Choosing and Implementing the Right Monitoring Tool
Everything You Need to Know About the 2019 DORA Accelerate State of DevOps Re...
Using Redgate, AKS and Azure to bring DevOps to your database
Using Redgate, AKS and Azure to bring DevOps to your Database
How to Pitch a Software Development Initiative and Ignite Culture Change
Taming the Wild West

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Spectroscopy.pptx food analysis technology
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
MYSQL Presentation for SQL database connectivity
PPT
Teaching material agriculture food technology
PDF
Machine learning based COVID-19 study performance prediction
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Encapsulation theory and applications.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Machine Learning_overview_presentation.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
“AI and Expert System Decision Support & Business Intelligence Systems”
Chapter 3 Spatial Domain Image Processing.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Spectroscopy.pptx food analysis technology
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Programs and apps: productivity, graphics, security and other tools
The Rise and Fall of 3GPP – Time for a Sabbatical?
MYSQL Presentation for SQL database connectivity
Teaching material agriculture food technology
Machine learning based COVID-19 study performance prediction
Assigned Numbers - 2025 - Bluetooth® Document
Encapsulation theory and applications.pdf
A Presentation on Artificial Intelligence
Spectral efficient network and resource selection model in 5G networks
Machine Learning_overview_presentation.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton

Grant Fritchey - Query Tuning In Azure SQL Database

Editor's Notes

  • #8: Sys.event_log: Event_type = throttling, throttling_long_transaction, deadlockEvent_subtype = actual reasonDescription Sys.database_connection_stats, aggregated connection info on 5 minute intervalsTwo levels of throttling, soft throttle on resources, killed connection both are in the details of sub-type40549 Session blocking system task for long period of time (20 seconds)40550 Session is consuming too many locks (1 million)40551 Session is consuming too much tempdb space (5gb)40552 Transaction consuming too much log space or active transaction preventing log truncation40553 Sessoin consuming memory (16mb) and there are memory waits (20 seconds)
  • #12: Just note objects available. Design and viewing & drag & drop from the Object Explorer to the query window
  • #13: Nothing magic, normal query window behavior including formatting & code coloring
  • #14: Again, normal stuff, note, execution times are for the server, not including latency
  • #15: Actual execution plan generated against SQL Database from SSMS
  • #16: SELECT operator from SQL Database. Point out information about memory & parallelism. Only real difference is NonParallelPlanReason. But that’s a difference that is reflected in SSMS.
  • #17: This is the property sheet from a SQL Server database SELECT operator.Note that for identical queries and identical data sets the operator cost estimates are different.
  • #19: Remember that the query performance is based on what’s in cache.
  • #20: Nothing exciting, but useful information. Note ability to modify time frame & layout
  • #21: Some customizable metrics. Most noteworthy for our purposes is the Throttled Connections
  • #22: Main management page. Queries are clickable. Columns are sortable.
  • #26: Note Save As, Open, etc. Syntax highlighting (of a sort).
  • #27: Works like tabs. You can look at more than one object or query and switch between them
  • #28: Query & results. No shocks
  • #29: In order to see the stats, must be run from the query. NOTE: You can include GO statements.
  • #35: Note that clicking on Actual Plan runs the query, not a toggle in this case.
  • #36: Mention that clicking on the icons in the lower left will hide the tool bar.
  • #39: Also sort by Merge, Hash, Sort, Scan, Seek, Warnings
  • #42: Se_repl_slow_secondary_throttle is due to secondary machines causing waits while information is transferred to them.Mention that when dealing with how to fix one of the three, cpu, io, memory; the solution is scale out with more hardware, but you have to deal with necessary changes to coding mechanisms.REPL is either a “Noisy neighbor” or you’re moving too much data. You’ll know you’re a noisy neighbor because you’ll be getting throttling alerts
  • #44: Just remember that there is ALWAYS memory pressure affecting the cache
  • #45: Be sure to mention that fragmented indexes leads to additional storage overhead and with limited options here, you pay for more, so defragmented indexes save the company money. Also more fragmentation can lead to longer running queries, so you may experience throttling.Operational stats is current activity