Start               Grant FritcheyQuery Performance Tuningin the Cloud
Goals   Explain the importance of query tuning within the   Azure SQL Database environment.   Show how the hybrid tool set...
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    »  ...
Then Why Use SQL Database?                    Extremely lowSpeed of delivery   management costCheap prices        Expandab...
What’s Old is New    Transactions as short as possible    Only move the data you need to move    Only move the data when y...
Checking on ThrottlingThrottlingMaster Database »  Sys.event_log »  Sys.database_connection_stats
Checking on Throttling
Tools for Query TuningQuery Tuning ToolsSQL Server Management StudioSQL Database Management PortalDynamic Management Objects
SQL Server Management StudioConnectivity required   Statistics IOObject Explorer         Statistics TimeQuery window      ...
SSMS – Object Explorer
SSMS - Query Window
SSMS - Statistics IO/Time
SSMS – Execution Plans
SSMS – Execution Plans
SSMS – Execution Plans
SQL Database Management PortalMonitor         Statistics TimeQuery window    Execution PlanStatistics IO
Portal: Monitor    Connection Activity     » Including throttled connections    Query Performance     » Aggregation     » ...
Monitor: Connection Activity
Monitor: Connection Activity
Monitor: Query Activity
Monitor: Query Details
Monitor: Query Plan
Portal: Query Window    Roughly same as SSMS query window    » No drag & drop for object names    » No code completion    ...
Query Window
Query Window: My Work
Query Window: Results
Query Window: Statistics
Query Window: Messages
Portal: Execution Plans    Graphical    Can be saved    Properties    Highlighting
Estimated Plan
Estimated Plan: SELECT Operator
Estimated Plan: SELECT Operator
Actual Plan: Sort by CPU
Actual Plan: Sort by IO
Actual Plan: Grid View
Actual Plan: Tree View
Actual Plan: Find Nested Loops
Actual Plan: Zoomed In
DMO Differences   Reset on database move    » Not reboot, restart, attach, detach, etc.    Operating system information is...
Wait State Monitoring    sys.dm_exec_requests does show waits    sys.dm_db_wait_stats    Special wait types    » SE_REPL_S...
Wait State Monitoring
Query DMOs   Sys.dm_exec_requests   Sys.dm_exec_query_stats   Sys.dm_exec_sql_text   Sys.dm_exec_query_plan   Sys.dm_exec_...
Index DMO   Sys.dm_db_index_operational_stats   Sys.dm_db_index_physical_stats   Sys.dm_db_index_usage_stats
Goals   Explain the importance of query tuning within the   Azure SQL Database environment.   Show how the hybrid tool set...
Resources   Scarydba.com/resources   SQL Server 2012 Query Performance Tuning   by Grant Fritchey   Performance Tuning wit...
Get in touch              Grant Fritchey           scarydba.com           grant@scarydba.com           @gfritchey
Upcoming SlideShare
Loading in …5
×

Query Tuning Azure SQL Databases

1,652 views

Published on

Learn the tools and methods available for tuning queries when working in Windows Azure SQL Database

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,652
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
18
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Query Tuning Azure SQL Databases

  1. 1. Start Grant FritcheyQuery Performance Tuningin the Cloud
  2. 2. 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.
  3. 3. Get in touch Grant Fritchey scarydba.com grant@scarydba.com @gfritchey
  4. 4. 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
  5. 5. Then Why Use SQL Database? Extremely lowSpeed of delivery management costCheap prices Expandable capacity
  6. 6. 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
  7. 7. Checking on ThrottlingThrottlingMaster Database »  Sys.event_log »  Sys.database_connection_stats
  8. 8. Checking on Throttling
  9. 9. Tools for Query TuningQuery Tuning ToolsSQL Server Management StudioSQL Database Management PortalDynamic Management Objects
  10. 10. SQL Server Management StudioConnectivity required Statistics IOObject Explorer Statistics TimeQuery window Execution Plans »  And not much else
  11. 11. SSMS – Object Explorer
  12. 12. SSMS - Query Window
  13. 13. SSMS - Statistics IO/Time
  14. 14. SSMS – Execution Plans
  15. 15. SSMS – Execution Plans
  16. 16. SSMS – Execution Plans
  17. 17. SQL Database Management PortalMonitor Statistics TimeQuery window Execution PlanStatistics IO
  18. 18. Portal: Monitor Connection Activity » Including throttled connections Query Performance » Aggregation » Details Cache dependent
  19. 19. Monitor: Connection Activity
  20. 20. Monitor: Connection Activity
  21. 21. Monitor: Query Activity
  22. 22. Monitor: Query Details
  23. 23. Monitor: Query Plan
  24. 24. Portal: Query Window Roughly same as SSMS query window » No drag & drop for object names » No code completion No properties » SET STATISTICS IO/TIME ON/OFF Execution plans » Actual » Estimated
  25. 25. Query Window
  26. 26. Query Window: My Work
  27. 27. Query Window: Results
  28. 28. Query Window: Statistics
  29. 29. Query Window: Messages
  30. 30. Portal: Execution Plans Graphical Can be saved Properties Highlighting
  31. 31. Estimated Plan
  32. 32. Estimated Plan: SELECT Operator
  33. 33. Estimated Plan: SELECT Operator
  34. 34. Actual Plan: Sort by CPU
  35. 35. Actual Plan: Sort by IO
  36. 36. Actual Plan: Grid View
  37. 37. Actual Plan: Tree View
  38. 38. Actual Plan: Find Nested Loops
  39. 39. Actual Plan: Zoomed In
  40. 40. DMO Differences Reset on database move » Not reboot, restart, attach, detach, etc. Operating system information is gone No clickable execution plans
  41. 41. 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
  42. 42. Wait State Monitoring
  43. 43. 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
  44. 44. Index DMO Sys.dm_db_index_operational_stats Sys.dm_db_index_physical_stats Sys.dm_db_index_usage_stats
  45. 45. 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.
  46. 46. 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
  47. 47. Get in touch Grant Fritchey scarydba.com grant@scarydba.com @gfritchey

×