ten things you do that make sql server cry. jen mccown microsoft sql server mvp recipient sql server...

14
TEN THINGS YOU DO THAT MAK E SQ L SERV ER CRY

Upload: leon-lamb

Post on 13-Jan-2016

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: TEN THINGS YOU DO THAT MAKE SQL SERVER CRY. JEN MCCOWN Microsoft SQL Server MVP recipient SQL Server developer and DBA  MidnightDBA.com MidnightDBA.com

TEN T

HINGS

Y OU

DO

TH

AT

MA

KE

SQ

L SE

RV

ER

CR

Y

Page 2: TEN THINGS YOU DO THAT MAKE SQL SERVER CRY. JEN MCCOWN Microsoft SQL Server MVP recipient SQL Server developer and DBA  MidnightDBA.com MidnightDBA.com

JEN MCCOWN

Microsoft SQL Server MVP recipient

SQL Server developer and DBA MidnightDBA.com [email protected] MidnightDBA.com/Jen Twitter.com/MidnightDBA webshow.MidnightDBA.com Fridays 11pm CST

Page 3: TEN THINGS YOU DO THAT MAKE SQL SERVER CRY. JEN MCCOWN Microsoft SQL Server MVP recipient SQL Server developer and DBA  MidnightDBA.com MidnightDBA.com

1. Design

2. Ugly code

3. ! Performance

4. ! Documentation

5. ! Testing

6. ! Understanding

7. Disk

8. Profiler

9. Indexing

10.Backups and maintenance

OVERVIEW: THE 10 THINGS

Page 4: TEN THINGS YOU DO THAT MAKE SQL SERVER CRY. JEN MCCOWN Microsoft SQL Server MVP recipient SQL Server developer and DBA  MidnightDBA.com MidnightDBA.com

THING 1: DESIGN

Unreadable names

Bad datatypes

Duplicate columns

Multipurpose columns

No relational integrity

And much, much more!

Page 5: TEN THINGS YOU DO THAT MAKE SQL SERVER CRY. JEN MCCOWN Microsoft SQL Server MVP recipient SQL Server developer and DBA  MidnightDBA.com MidnightDBA.com

THING 2: UGLY CODE

Ugly code is scary

Page 6: TEN THINGS YOU DO THAT MAKE SQL SERVER CRY. JEN MCCOWN Microsoft SQL Server MVP recipient SQL Server developer and DBA  MidnightDBA.com MidnightDBA.com

THING 3: PERFORMANCE

Cursors

Nested views

Lock hints

Just not bothering with it…

Page 7: TEN THINGS YOU DO THAT MAKE SQL SERVER CRY. JEN MCCOWN Microsoft SQL Server MVP recipient SQL Server developer and DBA  MidnightDBA.com MidnightDBA.com

THING 4: ! DOCUMENTATION

Nobody likes making documentation:

• It's a pain

• It gets out of date

• Nobody reads it

• “Don't need it!“

• "I can do it when the project is done!“

• “I'll document myself out of a job!"

Page 8: TEN THINGS YOU DO THAT MAKE SQL SERVER CRY. JEN MCCOWN Microsoft SQL Server MVP recipient SQL Server developer and DBA  MidnightDBA.com MidnightDBA.com

THING 5: ! TESTING

1. Code on dev or on a sandbox. Don't make changes in production!

2. Run your code...on dev.

3. Script out your deployment, and test that.

4. Have a rollback script, and test THAT.

5. Especially if you don't have a decent QA, watch the changes in production. Remember, "it always runs fast on the dev box".

Page 9: TEN THINGS YOU DO THAT MAKE SQL SERVER CRY. JEN MCCOWN Microsoft SQL Server MVP recipient SQL Server developer and DBA  MidnightDBA.com MidnightDBA.com

THING 6: ! UNDERSTANDING

Know before you GO

Page 10: TEN THINGS YOU DO THAT MAKE SQL SERVER CRY. JEN MCCOWN Microsoft SQL Server MVP recipient SQL Server developer and DBA  MidnightDBA.com MidnightDBA.com

THING 7: DISK

Disk Partition Alignment

RAID levels

Much more

Page 11: TEN THINGS YOU DO THAT MAKE SQL SERVER CRY. JEN MCCOWN Microsoft SQL Server MVP recipient SQL Server developer and DBA  MidnightDBA.com MidnightDBA.com

THING 8: PROFILER

Don’t run SQL Profiler on production

SQL Profiler can bring down production

Instead: Server Side Trace: The What, Why, and Howbit.ly/19x2wBD

Page 12: TEN THINGS YOU DO THAT MAKE SQL SERVER CRY. JEN MCCOWN Microsoft SQL Server MVP recipient SQL Server developer and DBA  MidnightDBA.com MidnightDBA.com

THING 9: ! INDEXING

Huh. Apparently this is an “index” clipart.

Indexes are good! Use them…

But there's a balance.

Don't index every column of a table individually!

Page 13: TEN THINGS YOU DO THAT MAKE SQL SERVER CRY. JEN MCCOWN Microsoft SQL Server MVP recipient SQL Server developer and DBA  MidnightDBA.com MidnightDBA.com

THING 10: ! BACKUPS / MAINTENANCE

You need backups

You need maintenance

You need alerting

Suggested: SQL Server Maintenance Solution http://ola.hallengren.com

Page 14: TEN THINGS YOU DO THAT MAKE SQL SERVER CRY. JEN MCCOWN Microsoft SQL Server MVP recipient SQL Server developer and DBA  MidnightDBA.com MidnightDBA.com

OTHER RESOURCES

All session materials available at MidnightDBA.com/Jen

Contact me:

[email protected]/MidnightDBA Other resources:

•MidnightDBA.com • SQLServerSamples.codeplex.com (AdventureWorks)• SSMSToolsPack.com•Ola.Hallengren.com