Tools and Tips:
From Accidental to Efficient
Data Warehouse Developer
Cathrine Wilhelmsen
August 27th 2016
Primary sponsors
The others…
Cathrine Wilhelmsen
@cathrinew
cathrinew.net
Data Warehouse Architect
Business Intelligence Developer
Experience?
T-SQL?
SSIS?
you?
once upon a time...
how I felt…
how I want to be...
SSMS
Queries
Biml for SSIS
what?
But first…
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
Tip #1: Visual Information
Connection Colors
Status Bar and Tab Text
Results in Separate Tab
Tab Groups - Vertical
Tab Groups - Horizontal
Split one query in two windows
Tip #2: Shortcuts
Query Shortcuts
Keyboard Shortcuts
Assign shortcuts
you frequently use
Remove shortcuts you
accidentally click
(no more "ooops")
msdn.microsoft.com/en-us/library/ms174205.aspx
HOME END
PG UP PG DNCTRL ALT
SHIFT TAB
Magic keys!
CTRL R
Show / Hide Query Results
ALTSHIFT ENTER
Toggle Full Screen
TABCTRL
Cycle through windows
CTRL U
Change database
SHIFTALT
Column / Multi-Line Editing
CTRL K CTRL C
Comment Line
CTRL K CTRL U
Uncomment Line
Comment / Uncomment
CTRL SHIFT V
Last 20 text items copied are
saved in memory
Cycle through them to paste
the text you need
Clipboard Ring
Tip #3: Search in SSMS
Free Tool: Redgate SQL Search
red-gate.com/products/sql-development/sql-search/
Free Tool: Redgate SQL Search
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
Tip #4: Templates and Snippets
Template Browser
Drag & Drop Templates
Create Templates
CTRL ALT T
Templates
Replace Template Parameters with actual values
CTRL SHIFT M
Template Parameters
CTRL K CTRL X
Insert Snippet
CTRL K CTRL S
Surround With Snippet
Snippets
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
Redgate SQL Prompt Demo
Tip #5: Registered Servers and
Multiserver Queries
Registered Servers
Save and group servers
Is the server running?
Multiserver Queries
View Registered Servers
CTRL ALT G
Manage services from SSMS
Multiserver Queries
Multiserver Queries
Tip #6: SARGable Queries
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…)
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'
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'
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…)
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'
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'
WHERE LEFT(Name,1,1) = 'T'
WHERE YEAR(EpisodeDate) = 2005
WHERE EpisodeDate >= '20050101'
AND EpisodeDate < '20060101'
SARGable or Non-SARGable?
WHERE LEFT(Name,1,1) = 'T'
WHERE YEAR(EpisodeDate) = 2005
WHERE EpisodeDate >= '20050101'
AND EpisodeDate < '20060101'
SARGable or Non-SARGable?
WHERE Name LIKE 'T%'
WHERE Name LIKE '%al%'
WHERE LEFT(Name,1,1) = 'T'
SARGable or Non-SARGable?
WHERE Name LIKE 'T%'
WHERE Name LIKE '%al%'
WHERE LEFT(Name,1,1) = 'T'
SARGable or Non-SARGable?
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?
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?
WHERE Survivors < 40000
WHERE @Survivors BETWEEN Survivors-1000
AND Survivors+1000
WHERE Survivors BETWEEN @Survivors-1000
AND @Survivors+1000
SARGable or Non-SARGable?
WHERE Survivors < 40000
WHERE @Survivors BETWEEN Survivors-1000
AND Survivors+1000
WHERE Survivors BETWEEN @Survivors-1000
AND @Survivors+1000
SARGable or Non-SARGable?
sqlbits.com/Sessions/Event7/Understanding_SARGability_to_make_your_queries_run_faster
Tip #7: Query Analysis
Execution Plans
Display Estimated Execution Plan
CTRL L
Include Actual Execution Plan
CTRL M
Execution Plans
See how a query will be executed:
Details in Tooltips
Details in Properties
Free Tool: SQL Sentry Plan Explorer
sqlsentry.com/products/plan-explorer
Free Tool: SQL Sentry Plan Explorer
answers.sqlperformance.com
red-gate.com/books
Free Book: SQL Server Execution Plans
by Grant Fritchey
Live Query Statistics
Include Live Query Statistics
Live Query Statistics
Include Live Query Statistics
Tip #8: Query Statistics
Statistics IO
SET STATISTICS IO OFF;
SET STATISTICS IO ON;
Statistics Time
SET STATISTICS TIME OFF;
SET STATISTICS TIME ON;
Statistics Time and IO
SET STATISTICS TIME, IO ON;
SET STATISTICS TIME, IO OFF;
Free Tool: Statistics Parser
statisticsparser.com
by Richie Rump
Client Statistics
Include Client Statistics
SHIFT SALT
Client Statistics
Compare multiple query executions:
Tip #9: Activity Monitoring
sqlblog.com/blogs/adam_machanic
Free Script: sp_WhoIsActive
By Adam Machanic
Free Script: sp_WhoIsActive
sqlblog.com/blogs/adam_machanic
By Adam Machanic
Tip #10: SSIS with Biml
…what do you need me to do after lunch?
Of course I can create 200 SSIS Packages!
Business Intelligence Markup Language
Easy to read and write XML language
Generate SSIS packages from metadata
What do you need?
Free add-in for SSDT
bidshelper.codeplex.com
…or you can use the new Biml tools
Free add-in for SSDT
varigence.com/bimlexpress
Free online Biml editor
bimlonline.com
Create many SSIS packages from one Biml file
How does it work?
Biml for SSIS demo
Where can I learn more?
Free online training
bimlscript.com
…BimlBreak the rest of the week 
Biml on Monday…
Evaluations
Raffle
@cathrinew
cathrinew.net
linkedin.com/in/cathrinewilhelmsen
hi@cathrinew.net
slideshare.net/cathrinewilhelmsen
Not enough details? Too fast? Don't worry!
cathrinew.net/efficient

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