sql server dev toolkit

42
A SQL Server Developer’s Toolkit

Upload: kirsten-benzel

Post on 18-Dec-2014

161 views

Category:

Technology


1 download

DESCRIPTION

Slides from Kirsten Benzel's presentation at The San Francisco SQL Server User Group MeetUp on September 10th, 2014.

TRANSCRIPT

Page 1: SQL Server Dev ToolKit

A SQL Server Developer’s Toolkit

Page 2: SQL Server Dev ToolKit

• Kirsten Benzel, Database Engineer at SurveyMonkey

• Twitter: CausalDensity

• Email: [email protected]

• Blog: http://kSQL.net

• SQL Server Magazine: http://sqlmag.com/author/kirsten-benzel

Page 3: SQL Server Dev ToolKit

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)

Page 4: SQL Server Dev ToolKit

Your computer just puked on it’s shoes. HAPPY MONDAY

Page 5: SQL Server Dev ToolKit

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.

Have a Recovery Plan

Page 6: SQL Server Dev ToolKit

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

Essential Programs

Page 7: SQL Server Dev ToolKit

SSMS Mastery

Page 8: SQL Server Dev ToolKit

ALT + F1

Page 9: SQL Server Dev ToolKit

Filter Object Explorer

Page 10: SQL Server Dev ToolKit

Change Tab Contents

Page 11: SQL Server Dev ToolKit

Alter SSMS StartUp Behavior

Page 12: SQL Server Dev ToolKit

Comma-Separated Column List

Page 13: SQL Server Dev ToolKit

Scripts: Eyes Everywhere

Page 14: SQL Server Dev ToolKit

Logins: Find Admins

Page 15: SQL Server Dev ToolKit

Logins: Get Detailed

Page 16: SQL Server Dev ToolKit

Oh, Crap! (1)

Page 17: SQL Server Dev ToolKit

Oh, Crap! (2)

Page 18: SQL Server Dev ToolKit

Oh, Crap! (3)

Page 19: SQL Server Dev ToolKit

SQL Job Info

Page 20: SQL Server Dev ToolKit

Space Used Interrogation (1)

Page 21: SQL Server Dev ToolKit

Space Used Interrogation (2)

Page 22: SQL Server Dev ToolKit

Space Used Interrogation (3)

Page 23: SQL Server Dev ToolKit

Space Used Interrogation (4)(Space Used by File)

Page 24: SQL Server Dev ToolKit

Index Interrogation (1)

Page 25: SQL Server Dev ToolKit

Index Interrogation (2)

Page 26: SQL Server Dev ToolKit

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.

Page 27: SQL Server Dev ToolKit

Index Interrogation (3)

Page 28: SQL Server Dev ToolKit

!

Demo Scripts

github.com/kbenzel/sql-scripts/

Page 29: SQL Server Dev ToolKit

Database Development

Page 30: SQL Server Dev ToolKit

Gracefully deal with change (and different personalities)

Page 31: SQL Server Dev ToolKit

Gracefully deal with change (and different personalities)

Be an advocate for using the best tool for the job.

Page 32: SQL Server Dev ToolKit

Legacy code and less-than-optimal current code.

Don’t disparage. Teach.

Page 33: SQL Server Dev ToolKit

Write elegant, good code.

Legacy code and less-than-optimal current code.

Don’t disparage. Teach.

Page 34: SQL Server Dev ToolKit

Compartmentalize. Have home and work balance.

Page 35: SQL Server Dev ToolKit

Deal with Make the most of criticism.

Compartmentalize. Have home and work balance.

Page 36: SQL Server Dev ToolKit

http://teespring.com/kcdbadmin?v=1

Page 37: SQL Server Dev ToolKit

Advancing Your Career

credit buzzfeed

Page 38: SQL Server Dev ToolKit

Twitter got me my job at SurveyMonkey.

#sqlhelp

RT = Re-TweetMRT = Modified Re-Tweet

TL;DR = Too Long, Didn’t Read# = This is a Hashtag

Page 39: SQL Server Dev ToolKit

Training & Keeping CurrentFollow 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

Page 40: SQL Server Dev ToolKit

Training & Keeping CurrentOnline 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)

Page 41: SQL Server Dev ToolKit

PASS Summit!#sqlpass #summit14

#sqlkilt #sqlrun #sqllongrun

sqlpass.org/summit/2014/Home.aspx

#ArgenisWithoutBorders bit.ly/1pJhn11

Page 42: SQL Server Dev ToolKit

• Demo Scripts: github.com/kbenzel/sql-scripts/• Kirsten Benzel, Database Engineer at SurveyMonkey• Twitter: CausalDensity• Email: [email protected]• Blog: http://kSQL.net• SQL Server Magazine: http://sqlmag.com/author/

kirsten-benzel

A SQL Server Developer’s Toolkit

Questions?