TechEd 2013 6/24/2018 8:28 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Query Performance Tuning in Windows Azure SQL DB 6/24/2018 8:28 PM DBI-B337 Query Performance Tuning in Windows Azure SQL DB Scott Klein, Grant Fritchey © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
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
Scott Klein
Why Tune Queries?
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? Extremely low management cost Speed of delivery Cheap prices Expandable capacity
What’s Old is New Transactions as short as possible Tune the queries Only move the data you need to move Only move the data when you need to move it Tune the queries
Connectivity
Coding for Retries WASD Errors General Errors Loss of Connection TechEd 2013 6/24/2018 8:28 PM Coding for Retries WASD Errors General Errors Loss of Connection © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Checking on Throttling Master Database Sys.event_log Sys.database_connection_stats
Throttling Scott Klein, Grant Fritchey
Tools
Tools for Query Tuning SQL Server Management Studio Query Tuning Tools SQL Server Management Studio SQL Database Management Portal Dynamic Management Objects
SQL Server Management Studio Connectivity required Statistics IO Object Explorer Statistics Time Query window And not much else Execution Plans
SSMS Scott Klein, Grant Fritchey
SQL Database Management Portal Monitor Statistics Time Query window Execution Plan Statistics IO
Portal: Monitor Connection Activity Query Performance Cache dependent Including throttled connections Query Performance Aggregation Details Cache dependent
Portal: Monitor Scott Klein, Grant Fritchey
Portal: Query Window Roughly same as SSMS query window No properties No drag & drop for object names No code completion No properties SET STATISTICS IO/TIME ON/OFF Execution plans Actual Estimated
Portal: Query Window Scott Klein, Grant Fritchey
Portal: Execution Plans Graphical Can be saved Properties Highlighting
Portal: Execution Plans Scott Klein, Grant Fritchey
DMO Differences Reset on database move Not reboot, restart, attach, detach, etc. Operating system information is gone No clickable execution plans
Wait State Monitoring sys.dm_exec_requests does show waits sys.dm_db_wait_stats Special wait types SE_REPL_SLOW_SECONDARY_THROTTLE SE_REPL_COMMIT_ACK Expected wait types RESOURCE_SEMAPHORE *IO_LATCH SOS_SCHEDULER_YIELD
Wait State Monitoring Scott Klein, Grant Fritchey
Query DMOs Sys.dm_exec_requests Sys.dm_exec_query_stats Sys.dm_exec_sql_text Sys.dm_exec_query_plan Sys.dm_exec_query_plan_text
Query DMOs Scott Klein, Grant Fritchey
Index DMOs Sys.dm_db_index_operational_stats Sys.dm_db_index_physical_stats Sys.dm_db_index_usage_stats
Index DMOs Scott Klein, Grant Fritchey
Conclusion
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.
Resources Scarydba.com/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
Scott Klein
Download Data Explorer Track Resources Download Data Explorer SQL Server Website Hands-On Labs @sqlserver Download Geoflow mva Microsoft Virtual Academy Get Certified! Windows Azure
Resources Learning TechNet msdn http://channel9.msdn.com/Events/TechEd 6/24/2018 8:28 PM Resources Learning Sessions on Demand http://channel9.msdn.com/Events/TechEd Microsoft Certification & Training Resources www.microsoft.com/learning TechNet msdn Resources for IT Professionals http://microsoft.com/technet Resources for Developers http://microsoft.com/msdn © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Complete an evaluation on CommNet and enter to win! 6/24/2018 8:28 PM Complete an evaluation on CommNet and enter to win! © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
6/24/2018 8:28 PM Required Slide *delete this box when your slide is finalized Your MS Tag will be inserted here during the final scrub. Evaluate this session Scan this QR code to evaluate this session and be automatically entered in a drawing to win a prize © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
6/24/2018 8:28 PM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.