Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLSaturday Gothenburg)

436 views

Published on

Tools and Tips: From Accidental to Efficient Data Warehouse Developer (Presented at SQLSaturday Gothenburg on August 27th 2016)

Published in: Data & Analytics
  • Be the first to comment

Tools and Tips: From Accidental to Efficient Data Warehouse Developer (SQLSaturday Gothenburg)

  1. 1. Tools and Tips: From Accidental to Efficient Data Warehouse Developer Cathrine Wilhelmsen August 27th 2016
  2. 2. Primary sponsors
  3. 3. The others…
  4. 4. Cathrine Wilhelmsen @cathrinew cathrinew.net Data Warehouse Architect Business Intelligence Developer
  5. 5. Experience? T-SQL? SSIS? you?
  6. 6. once upon a time...
  7. 7. how I felt…
  8. 8. how I want to be...
  9. 9. SSMS Queries Biml for SSIS what?
  10. 10. But first…
  11. 11. PASS and the SQL Server Community PASS Summit SQLSaturdays 24 Hours of PASS Local Chapters Virtual Chapters passsummit.com sqlsaturday.com 24hoursofpass.com sqlpass.org sqlug.se
  12. 12. Tip #1: Visual Information
  13. 13. Connection Colors
  14. 14. Status Bar and Tab Text
  15. 15. Results in Separate Tab
  16. 16. Tab Groups - Vertical
  17. 17. Tab Groups - Horizontal
  18. 18. Split one query in two windows
  19. 19. Tip #2: Shortcuts
  20. 20. Query Shortcuts
  21. 21. Keyboard Shortcuts Assign shortcuts you frequently use Remove shortcuts you accidentally click (no more "ooops") msdn.microsoft.com/en-us/library/ms174205.aspx
  22. 22. HOME END PG UP PG DNCTRL ALT SHIFT TAB Magic keys!
  23. 23. CTRL R Show / Hide Query Results
  24. 24. ALTSHIFT ENTER Toggle Full Screen
  25. 25. TABCTRL Cycle through windows
  26. 26. CTRL U Change database
  27. 27. SHIFTALT Column / Multi-Line Editing
  28. 28. CTRL K CTRL C Comment Line CTRL K CTRL U Uncomment Line Comment / Uncomment
  29. 29. CTRL SHIFT V Last 20 text items copied are saved in memory Cycle through them to paste the text you need Clipboard Ring
  30. 30. Tip #3: Search in SSMS
  31. 31. Free Tool: Redgate SQL Search red-gate.com/products/sql-development/sql-search/
  32. 32. Free Tool: Redgate SQL Search
  33. 33. Redgate SQL Search ApexSQL Search SSMS Tools Pack (Licensed) SSMS Boost SQL Hunting Dog red-gate.com apexsql.com ssmstoolspack.com ssmsboost.com sql-hunting-dog.com Tools: Search in SSMS
  34. 34. Tip #4: Templates and Snippets
  35. 35. Template Browser Drag & Drop Templates Create Templates CTRL ALT T Templates
  36. 36. Replace Template Parameters with actual values CTRL SHIFT M Template Parameters
  37. 37. CTRL K CTRL X Insert Snippet CTRL K CTRL S Surround With Snippet Snippets
  38. 38. Redgate SQL Prompt (Licensed) ApexSQL Complete / Refactor SSMS Tools Pack (Licensed) SSMS Boost Poor Man's T-SQL Formatter dbForge SQL Complete (Licensed) SQL Formatter red-gate.com apexsql.com ssmstoolspack.com ssmsboost.com poorsql.com devart.com/dbforge sql-format.com Advanced Snippets and Formatting
  39. 39. Redgate SQL Prompt Demo
  40. 40. Tip #5: Registered Servers and Multiserver Queries
  41. 41. Registered Servers Save and group servers Is the server running? Multiserver Queries View Registered Servers CTRL ALT G
  42. 42. Manage services from SSMS
  43. 43. Multiserver Queries
  44. 44. Multiserver Queries
  45. 45. Tip #6: SARGable Queries
  46. 46. SARGable Queries "The query can efficiently seek using an index to find the rows searched for in WHERE or JOIN clauses" Compare it to finding a person in a phone book (…let's just pretend we still use phone books…)
  47. 47. SARGable Queries Adama, Lee Adama, William Agathon, Karl Baltar, Gaius Dualla, Anastasia Gaeta, Felix Henderson, Cally Roslin, Laura Thrace, Kara Tigh, Saul Tyrol, Galen Valerii, Sharon Find all rows where Name starts with 'T'
  48. 48. SARGable Queries Adama, Lee Adama, William Agathon, Karl Baltar, Gaius Dualla, Anastasia Gaeta, Felix Henderson, Cally Roslin, Laura Thrace, Kara Tigh, Saul Tyrol, Galen Valerii, Sharon Find all rows where Name starts with 'T'
  49. 49. Non-SARGable Queries "The query has to scan each row in the table to find the rows searched for in WHERE or JOIN clauses" Compare it to finding a person in a phone book (…let's just keep pretending we still use phone books…)
  50. 50. Non-SARGable Queries Adama, Lee Adama, William Agathon, Karl Baltar, Gaius Dualla, Anastasia Gaeta, Felix Henderson, Cally Roslin, Laura Thrace, Kara Tigh, Saul Tyrol, Galen Valerii, Sharon Find all rows where Name contains 'al'
  51. 51. Non-SARGable Queries Adama, Lee Adama, William Agathon, Karl Baltar, Gaius Dualla, Anastasia Gaeta, Felix Henderson, Cally Roslin, Laura Thrace, Kara Tigh, Saul Tyrol, Galen Valerii, Sharon Find all rows where Name contains 'al'
  52. 52. WHERE LEFT(Name,1,1) = 'T' WHERE YEAR(EpisodeDate) = 2005 WHERE EpisodeDate >= '20050101' AND EpisodeDate < '20060101' SARGable or Non-SARGable?
  53. 53. WHERE LEFT(Name,1,1) = 'T' WHERE YEAR(EpisodeDate) = 2005 WHERE EpisodeDate >= '20050101' AND EpisodeDate < '20060101' SARGable or Non-SARGable?
  54. 54. WHERE Name LIKE 'T%' WHERE Name LIKE '%al%' WHERE LEFT(Name,1,1) = 'T' SARGable or Non-SARGable?
  55. 55. WHERE Name LIKE 'T%' WHERE Name LIKE '%al%' WHERE LEFT(Name,1,1) = 'T' SARGable or Non-SARGable?
  56. 56. WHERE CAST(EpisodeDate AS DATE) = '20050114' WHERE CONVERT(CHAR(6),EpisodeDate,112) = '200501' WHERE YEAR(EpisodeDate) = 2005 WHERE EpisodeDate >= '20050101' AND EpisodeDate < '20060101' SARGable or Non-SARGable?
  57. 57. WHERE CAST(EpisodeDate AS DATE) = '20050114' WHERE CONVERT(CHAR(6),EpisodeDate,112) = '200501' WHERE YEAR(EpisodeDate) = 2005 WHERE EpisodeDate >= '20050101' AND EpisodeDate < '20060101' SARGable or Non-SARGable?
  58. 58. WHERE Survivors < 40000 WHERE @Survivors BETWEEN Survivors-1000 AND Survivors+1000 WHERE Survivors BETWEEN @Survivors-1000 AND @Survivors+1000 SARGable or Non-SARGable?
  59. 59. WHERE Survivors < 40000 WHERE @Survivors BETWEEN Survivors-1000 AND Survivors+1000 WHERE Survivors BETWEEN @Survivors-1000 AND @Survivors+1000 SARGable or Non-SARGable?
  60. 60. sqlbits.com/Sessions/Event7/Understanding_SARGability_to_make_your_queries_run_faster
  61. 61. Tip #7: Query Analysis
  62. 62. Execution Plans Display Estimated Execution Plan CTRL L Include Actual Execution Plan CTRL M
  63. 63. Execution Plans See how a query will be executed:
  64. 64. Details in Tooltips
  65. 65. Details in Properties
  66. 66. Free Tool: SQL Sentry Plan Explorer sqlsentry.com/products/plan-explorer
  67. 67. Free Tool: SQL Sentry Plan Explorer answers.sqlperformance.com
  68. 68. red-gate.com/books Free Book: SQL Server Execution Plans by Grant Fritchey
  69. 69. Live Query Statistics Include Live Query Statistics
  70. 70. Live Query Statistics Include Live Query Statistics
  71. 71. Tip #8: Query Statistics
  72. 72. Statistics IO SET STATISTICS IO OFF; SET STATISTICS IO ON;
  73. 73. Statistics Time SET STATISTICS TIME OFF; SET STATISTICS TIME ON;
  74. 74. Statistics Time and IO SET STATISTICS TIME, IO ON; SET STATISTICS TIME, IO OFF;
  75. 75. Free Tool: Statistics Parser statisticsparser.com by Richie Rump
  76. 76. Client Statistics Include Client Statistics SHIFT SALT
  77. 77. Client Statistics Compare multiple query executions:
  78. 78. Tip #9: Activity Monitoring
  79. 79. sqlblog.com/blogs/adam_machanic Free Script: sp_WhoIsActive By Adam Machanic
  80. 80. Free Script: sp_WhoIsActive sqlblog.com/blogs/adam_machanic By Adam Machanic
  81. 81. Tip #10: SSIS with Biml
  82. 82. …what do you need me to do after lunch? Of course I can create 200 SSIS Packages!
  83. 83. Business Intelligence Markup Language Easy to read and write XML language Generate SSIS packages from metadata
  84. 84. What do you need? Free add-in for SSDT bidshelper.codeplex.com
  85. 85. …or you can use the new Biml tools Free add-in for SSDT varigence.com/bimlexpress Free online Biml editor bimlonline.com
  86. 86. Create many SSIS packages from one Biml file How does it work?
  87. 87. Biml for SSIS demo
  88. 88. Where can I learn more? Free online training bimlscript.com
  89. 89. …BimlBreak the rest of the week  Biml on Monday…
  90. 90. Evaluations Raffle
  91. 91. @cathrinew cathrinew.net linkedin.com/in/cathrinewilhelmsen hi@cathrinew.net slideshare.net/cathrinewilhelmsen Not enough details? Too fast? Don't worry! cathrinew.net/efficient

×