KEMBAR78
SQL Server Dev ToolKit | PDF
A SQL Server 
Developer’s Toolkit
• Kirsten Benzel, Database Engineer at SurveyMonkey 
• Twitter: CausalDensity 
• Email: Kirsten@kSQL.net 
• Blog: http://kSQL.net 
• SQL Server Magazine: http://sqlmag.com/author/kirsten-benzel
What is Causal Density? 
From a book review titled Controlling The Uncontrollable on Jim Manzi’s 
Uncontrolled, Kevin Drum writes: 
! 
“If you're studying the orbit of a planet, you can pretty 
much assume there's only one important cause of the 
planet's movement: gravity. Causal density is low … in 
human affairs, there are lots of causes of everything, 
there are causes of the causes, and the causes often 
interact in complex ways. Causal density is very 
high, which means it's very hard to make sure you've 
accounted for everything.” 
! 
(Emphasis mine, motherjones.com/kevin-drum/2012/05/controlling-uncontrollable)
Your computer just puked on it’s shoes. 
HAPPY MONDAY
Have a Recovery Plan 
1. List of all your installed programs and license keys. 
Include versions and installation steps for difficult installs. 
2. Keep your web browser Bookmarks backed up. 
3. Keep a list of your mapped drives - the full extension, not 
the truncated version you see in My Computer (Windows 
Users). 
4. Keep important folders backed up: SSMS Templates, my 
Desktop folders, my Powershell script folder, and the 
databases for KeePass and Stickies. 
5. Write down the location of your SSMS Templates. 
6. Write a .bat file that dumps all the above from your 
workstation to a external drive.
Essential Programs 
SQL Server Management Studio and Local SQL Instance 
Visual Studio (may need different versions for SSIS packages) 
Anything other than Notepad: TextPad, WordPad, Notepad++ 
Adept SQL Diff adeptsql.com/download.htm 
7-Zip 7-zip.org/download.html 
Stickies zhornsoftware.co.uk/stickies/download.html 
Softerra LDAP Browser ldapadministrator.com/download.htm 
KeePass keepass.info/download.html
SSMS Mastery
ALT + F1
Filter Object Explorer
Change Tab Contents
Alter SSMS StartUp Behavior
Comma-Separated Column List
Scripts: Eyes Everywhere
Logins: Find Admins
Logins: Get Detailed
Oh, Crap! (1)
Oh, Crap! (2)
Oh, Crap! (3)
SQL Job Info
Space Used Interrogation (1)
Space Used Interrogation (2)
Space Used Interrogation (3)
Space Used Interrogation (4) 
(Space Used by File)
Index Interrogation (1)
Index Interrogation (2)
Index Interrogation (2a) 
--[Reads] = SUM(DUS.user_seeks + DUS.user_scans + DUS.user_lookups), 
[Seeks] 
= DUS.user_seeks, 
[Scans] 
= DUS.user_scans, 
[Lookups] = DUS.user_lookups, 
[Writes] = DUS.user_updates, 
! 
[Reads Per Write] = CONVERT(DECIMAL(10,2), MAX(CASE WHEN DUS.user_updates < 1 THEN 100.00 
ELSE 1.00 * (DUS.user_seeks + DUS.user_scans + DUS.user_lookups) / DUS.user_updates END)), 
--[Last Read] = CONVERT(CHAR(10), (SELECT MAX(v) FROM (VALUES (DUS.last_user_seek), 
(DUS.last_user_scan), (DUS.last_user_lookup)) AS value(v)), 101), 
[Last Seek] = DUS.last_user_seek, 
[Last Scan] = DUS.last_user_scan, 
[Last Lookup] = DUS.last_user_lookup 
Reads Per Write can help identify indexes that have not been used since the last restart or aren't helping to improve 
performance. For every 1 write to the index, you want to see as many reads as possible. 
! 
Indexes with a reads_per_write score of 1 means that for every 1 write, the index is also used 1 time to help with 
performance. Ideally, you want to see scores much higher than that. 
! 
Consider dropping indexes with a reads_per_write score under 0 and strongly consider dropping ones with scores under .1. 
! 
This isn't a hard-and-fast rule: you may have an index that's used once per month for a single report, but that report is run by 
the CEO and he wants it instantaneously. Before dropping indexes, know what they're used for or make sure alternate 
indexes exist.
Index Interrogation (3)
! 
Demo Scripts 
github.com/kbenzel/sql-scripts/
Database Development
Gracefully deal with change 
(and different personalities)
Gracefully deal with change 
(and different personalities) 
Be an advocate for using the 
best tool for the job.
Legacy code and 
less-than-optimal current code. 
Don’t disparage. Teach.
Write elegant, good code. 
Legacy code and 
less-than-optimal current code. 
Don’t disparage. Teach.
Compartmentalize. 
Have home and work balance.
Deal with Make the most of 
criticism. 
Compartmentalize. 
Have home and work balance.
http://teespring.com/kcdbadmin?v=1
Advancing Your Career 
credit buzzfeed
#sqlhelp 
Twitter got me my job at SurveyMonkey. 
RT = Re-Tweet 
MRT = Modified Re-Tweet 
TL;DR = Too Long, Didn’t Read 
# = This is a Hashtag
Training & Keeping Current 
Follow SQL professionals on Twitter. They will post their blogs AND 
re-tweet other articles and news! 
! 
Sign up for free newsletters. 
! 
Brent Ozar Unlimited® Weekly Links - BrentOzar.com 
! 
! 
! 
SQLSkills Insiders Weekly Newsletter - SQLSkills.com/Insider
Training & Keeping Current 
Online Training 
• PluralSight.com 
• Free WebCasts (I hear about them on Twitter) 
! 
Conferences and In-Person 
• SQLSkills (Paul Randal and Kimberly Tripp) 
• sqlskills.com/sql-server-training/ 
• IEPTO1: Immersion Event on Performance Tuning and Optimization – Part 1 (formerly IE1)
sqlpass.org/summit/2014/Home.aspx 
PASS Summit! 
#sqlpass #summit14 
#sqlkilt 
#sqlrun #sqllongrun 
#ArgenisWithoutBorders 
bit.ly/1pJhn11
A SQL Server Developer’s Toolkit 
Questions? 
• Demo Scripts: github.com/kbenzel/sql-scripts/ 
• Kirsten Benzel, Database Engineer at SurveyMonkey 
• Twitter: CausalDensity 
• Email: Kirsten@kSQL.net 
• Blog: http://kSQL.net 
• SQL Server Magazine: http://sqlmag.com/author/ 
kirsten-benzel

SQL Server Dev ToolKit

  • 1.
    A SQL Server Developer’s Toolkit
  • 2.
    • Kirsten Benzel,Database Engineer at SurveyMonkey • Twitter: CausalDensity • Email: Kirsten@kSQL.net • Blog: http://kSQL.net • SQL Server Magazine: http://sqlmag.com/author/kirsten-benzel
  • 3.
    What is CausalDensity? From a book review titled Controlling The Uncontrollable on Jim Manzi’s Uncontrolled, Kevin Drum writes: ! “If you're studying the orbit of a planet, you can pretty much assume there's only one important cause of the planet's movement: gravity. Causal density is low … in human affairs, there are lots of causes of everything, there are causes of the causes, and the causes often interact in complex ways. Causal density is very high, which means it's very hard to make sure you've accounted for everything.” ! (Emphasis mine, motherjones.com/kevin-drum/2012/05/controlling-uncontrollable)
  • 4.
    Your computer justpuked on it’s shoes. HAPPY MONDAY
  • 5.
    Have a RecoveryPlan 1. List of all your installed programs and license keys. Include versions and installation steps for difficult installs. 2. Keep your web browser Bookmarks backed up. 3. Keep a list of your mapped drives - the full extension, not the truncated version you see in My Computer (Windows Users). 4. Keep important folders backed up: SSMS Templates, my Desktop folders, my Powershell script folder, and the databases for KeePass and Stickies. 5. Write down the location of your SSMS Templates. 6. Write a .bat file that dumps all the above from your workstation to a external drive.
  • 6.
    Essential Programs SQLServer Management Studio and Local SQL Instance Visual Studio (may need different versions for SSIS packages) Anything other than Notepad: TextPad, WordPad, Notepad++ Adept SQL Diff adeptsql.com/download.htm 7-Zip 7-zip.org/download.html Stickies zhornsoftware.co.uk/stickies/download.html Softerra LDAP Browser ldapadministrator.com/download.htm KeePass keepass.info/download.html
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
    Space Used Interrogation(4) (Space Used by File)
  • 24.
  • 25.
  • 26.
    Index Interrogation (2a) --[Reads] = SUM(DUS.user_seeks + DUS.user_scans + DUS.user_lookups), [Seeks] = DUS.user_seeks, [Scans] = DUS.user_scans, [Lookups] = DUS.user_lookups, [Writes] = DUS.user_updates, ! [Reads Per Write] = CONVERT(DECIMAL(10,2), MAX(CASE WHEN DUS.user_updates < 1 THEN 100.00 ELSE 1.00 * (DUS.user_seeks + DUS.user_scans + DUS.user_lookups) / DUS.user_updates END)), --[Last Read] = CONVERT(CHAR(10), (SELECT MAX(v) FROM (VALUES (DUS.last_user_seek), (DUS.last_user_scan), (DUS.last_user_lookup)) AS value(v)), 101), [Last Seek] = DUS.last_user_seek, [Last Scan] = DUS.last_user_scan, [Last Lookup] = DUS.last_user_lookup Reads Per Write can help identify indexes that have not been used since the last restart or aren't helping to improve performance. For every 1 write to the index, you want to see as many reads as possible. ! Indexes with a reads_per_write score of 1 means that for every 1 write, the index is also used 1 time to help with performance. Ideally, you want to see scores much higher than that. ! Consider dropping indexes with a reads_per_write score under 0 and strongly consider dropping ones with scores under .1. ! This isn't a hard-and-fast rule: you may have an index that's used once per month for a single report, but that report is run by the CEO and he wants it instantaneously. Before dropping indexes, know what they're used for or make sure alternate indexes exist.
  • 27.
  • 28.
    ! Demo Scripts github.com/kbenzel/sql-scripts/
  • 29.
  • 30.
    Gracefully deal withchange (and different personalities)
  • 31.
    Gracefully deal withchange (and different personalities) Be an advocate for using the best tool for the job.
  • 32.
    Legacy code and less-than-optimal current code. Don’t disparage. Teach.
  • 33.
    Write elegant, goodcode. Legacy code and less-than-optimal current code. Don’t disparage. Teach.
  • 34.
    Compartmentalize. Have homeand work balance.
  • 35.
    Deal with Makethe most of criticism. Compartmentalize. Have home and work balance.
  • 36.
  • 37.
    Advancing Your Career credit buzzfeed
  • 38.
    #sqlhelp Twitter gotme my job at SurveyMonkey. RT = Re-Tweet MRT = Modified Re-Tweet TL;DR = Too Long, Didn’t Read # = This is a Hashtag
  • 39.
    Training & KeepingCurrent Follow SQL professionals on Twitter. They will post their blogs AND re-tweet other articles and news! ! Sign up for free newsletters. ! Brent Ozar Unlimited® Weekly Links - BrentOzar.com ! ! ! SQLSkills Insiders Weekly Newsletter - SQLSkills.com/Insider
  • 40.
    Training & KeepingCurrent Online Training • PluralSight.com • Free WebCasts (I hear about them on Twitter) ! Conferences and In-Person • SQLSkills (Paul Randal and Kimberly Tripp) • sqlskills.com/sql-server-training/ • IEPTO1: Immersion Event on Performance Tuning and Optimization – Part 1 (formerly IE1)
  • 41.
    sqlpass.org/summit/2014/Home.aspx PASS Summit! #sqlpass #summit14 #sqlkilt #sqlrun #sqllongrun #ArgenisWithoutBorders bit.ly/1pJhn11
  • 42.
    A SQL ServerDeveloper’s Toolkit Questions? • Demo Scripts: github.com/kbenzel/sql-scripts/ • Kirsten Benzel, Database Engineer at SurveyMonkey • Twitter: CausalDensity • Email: Kirsten@kSQL.net • Blog: http://kSQL.net • SQL Server Magazine: http://sqlmag.com/author/ kirsten-benzel