Stop Bad Data in its
OLTP Tracks
Denise McInerney
Silicon Valley SQL Server Users Group
June 19, 2012
Copyright © 2012 Denise McInerney
Agenda
Topics
 What is “bad” data?
 Table design
 NULL pitfalls
 Constraints: friend or foe?
 Hardcoding
 Transactions
 Garbage in
 Testing
 Change Management & Controls
Silicon Valley SQL Server Users Group
June 19, 2012 2Copyright © 2012 Denise McInerney
Who am I?
• SQL Server DBA since 1998
 Web-based OLTP applications
 Focus on design and
performance tuning
• Staff DBA Intuit
• Director, PASS Board
• Virtual Chapters
• Women in Tech VC
• Contact me:
 denise.mcinerney@sqlpass.org
 denise_mcinerney@intuit.com
 @denisemc06
Copyright © 2012 Denise McInerney 3
Silicon Valley SQL Server Users Group
June 19, 2012
My Framework
 DBA = data steward
 Backups, security—what about quality?
 DBA <> Developer
 Don‟t count on ETL for everything
Silicon Valley SQL Server Users Group
June 19, 2012 4Copyright © 2012 Denise McInerney
Define “bad” data
 Inaccurate
 Missing
 Misleading
 Causes bugs
 Breaks reports
 Can compromise security
 Impacts customers
 Impacts business
Silicon Valley SQL Server Users Group
June 19, 2012 5Copyright © 2012 Denise McInerney
Design
 Have one—even in an “agile” shop
 It‟s a system, not a collection of tables
 Don‟t be lazy
 Bad design invites bad data
Silicon Valley SQL Server Users Group
June 19, 2012 6Copyright © 2012 Denise McInerney
Design
Silicon Valley SQL Server Users Group
June 19, 2012 Copyright © 2012 Denise McInerney 7
Bad Design Examples
Silicon Valley SQL Server Users Group
June 19, 2012 8Copyright © 2012 Denise McInerney
Pitfalls of NULL
 What is NULL?
 Missing data
 Unknown in comparisons
 NULL <> „‟ or “”
 NULL <> 0
 NULL can be valid
 But application can‟t handle it
Silicon Valley SQL Server Users Group
June 19, 2012 Copyright © 2012 Denise McInerney 9
NULL Examples
Silicon Valley SQL Server Users Group
June 19, 2012 Copyright © 2012 Denise McInerney 10
Constraints: Your Frenemies
 CHECK
 INSERT/UPDATE fails if condition evaluates to
FALSE
 Comparisons to NULL result in unknown
 Can use to enforce logic, business rules
 DEFAULT
 Can prevent some bugs
 Won‟t solve all your problems
 Can be “forgotten”
 100% of records have default value
Silicon Valley SQL Server Users Group
June 19, 2012 Copyright © 2012 Denise McInerney 11
Constraint Examples
Silicon Valley SQL Server Users Group
June 19, 2012 Copyright © 2012 Denise McInerney 12
Hardcoding
Silicon Valley SQL Server Users Group
June 19, 2012 Copyright © 2012 Denise McInerney 13
Transactions
 Understand them
 Don‟t assume others understand them
 BEGIN TRAN…COMMIT TRAN is not
enough
 Failed INSERT…the silent killer
Silicon Valley SQL Server Users Group
June 19, 2012 14Copyright © 2012 Denise McInerney
Transactions
Silicon Valley SQL Server Users Group
June 19, 2012 Copyright © 2012 Denise McInerney 15
Garbage In
 Many ways things go wrong
 Concatenation
 Recycled identifiers
 Duplicates
 Honor the schema
 Be consistent
 Fix it on the way in
Silicon Valley SQL Server Users Group
June 19, 2012 16Copyright © 2012 Denise McInerney
Garbage In
Silicon Valley SQL Server Users Group
June 19, 2012 Copyright © 2012 Denise McInerney 17
Testing
 Database is not exempt
 Not just the happy path
 Look at the data!
 People
 Machines
Silicon Valley SQL Server Users Group
June 19, 2012 18Copyright © 2012 Denise McInerney
Change Control
 Lots of ways data gets IN
 Code—application & SQL
 Version control & Management
 Scripts
 GUI (!)
 People
 Everyone takes short cuts
 Every check-in potential data bug
Silicon Valley SQL Server Users Group
June 19, 2012 Copyright © 2012 Denise McInerney 19
There is no “I” in “Bad Data”
Silicon Valley SQL Server Users Group
June 19, 2012 Copyright © 2012 Denise McInerney 20
Pessimism
Silicon Valley SQL Server Users Group
June 19, 2012 Copyright © 2012 Denise McInerney 21
Vigilance
Silicon Valley SQL Server Users Group
June 19, 2012 Copyright © 2012 Denise McInerney 22
Summary
 DBA‟s job to guard data quality
 Design, Plan, Process, Controls
 Engage Others
 Keep your guard up
Silicon Valley SQL Server Users Group
June 19, 2012 Copyright © 2012 Denise McInerney 23
Q & A
Silicon Valley SQL Server Users Group
June 19, 2012 Copyright © 2012 Denise McInerney 24

More Related Content

PPTX
A Case for Women in Technology
PDF
Test
PDF
Skmbt c45011111710501
PDF
Wilmer StudyCertificates1 (1)
PDF
NCHCA Medical Marijuana Initiative
DOCX
Unidad 1 formulacion
PDF
Predictive-Control-For-Harmonic-And-Unbalance-Compensation-Using-Active-Power...
DOCX
Rois teori psikologi
A Case for Women in Technology
Test
Skmbt c45011111710501
Wilmer StudyCertificates1 (1)
NCHCA Medical Marijuana Initiative
Unidad 1 formulacion
Predictive-Control-For-Harmonic-And-Unbalance-Compensation-Using-Active-Power...
Rois teori psikologi

Viewers also liked (14)

PDF
WilmerFrancoApplicationHSEPhotos (1)
PPTX
Question 7
PPTX
Detector de linea
DOCX
PPT
Análisis práctico de un ensayo clínico: en qué tengo que fijarme
ODP
Guillin regola dei_terzi
PDF
PPT
Hipertensión pulmonar en la edad pediátrica: enfermedades específicas
PDF
HF 410
PDF
IT In Europe
PDF
A case for women in technology
PDF
Decisiones de financiamiento - Octubre 2015
PPTX
Swap
PPTX
1 proteccion y conservacion de los alimentos
WilmerFrancoApplicationHSEPhotos (1)
Question 7
Detector de linea
Análisis práctico de un ensayo clínico: en qué tengo que fijarme
Guillin regola dei_terzi
Hipertensión pulmonar en la edad pediátrica: enfermedades específicas
HF 410
IT In Europe
A case for women in technology
Decisiones de financiamiento - Octubre 2015
Swap
1 proteccion y conservacion de los alimentos
Ad

Similar to Stop Bad Data in its OLTP Tracks (20)

PDF
Microsoft SQL Server DBA as Protector of the Data - Oct 2010
PPTX
Top 10 DBA Mistakes on Microsoft SQL Server
PDF
Brad McGehee Become an Exceptional DBA March 2009
PPTX
Sql server infernals
PDF
Being Buck Woody - PASS Summit 2014 Edition
PPTX
Sql good practices
DOCX
Chapter 3Data Management,Big Data Analytics, andRecords Ma.docx
DOCX
Chapter 3Data Management,Big Data Analytics, andRecords Ma.docx
PPTX
PPTX
Who wants to be a DBA? Roles and Responsibilities
PDF
Chapter deck 2010 june
PDF
LogLogic SQL Server Hacking DBs April09
PPTX
Redgate How to be Friends with Developers
PPTX
10 Ways To Abuse T-SQL
PPTX
SQL Server Worst Practices - EN
PDF
Joe Celko s SQL for Smarties Fourth Edition Advanced SQL Programming Joe Celko
PPTX
The Role of the DBA in the Development Shop
PDF
100 Sql Server Mistakes And How To Avoid Them Meap V01 Chapters 1 To 4 Of 14 ...
PPT
Supporting SQLserver
PDF
Sql For Ibm I A Database Modernization Guide None Rafael Victriapereira
Microsoft SQL Server DBA as Protector of the Data - Oct 2010
Top 10 DBA Mistakes on Microsoft SQL Server
Brad McGehee Become an Exceptional DBA March 2009
Sql server infernals
Being Buck Woody - PASS Summit 2014 Edition
Sql good practices
Chapter 3Data Management,Big Data Analytics, andRecords Ma.docx
Chapter 3Data Management,Big Data Analytics, andRecords Ma.docx
Who wants to be a DBA? Roles and Responsibilities
Chapter deck 2010 june
LogLogic SQL Server Hacking DBs April09
Redgate How to be Friends with Developers
10 Ways To Abuse T-SQL
SQL Server Worst Practices - EN
Joe Celko s SQL for Smarties Fourth Edition Advanced SQL Programming Joe Celko
The Role of the DBA in the Development Shop
100 Sql Server Mistakes And How To Avoid Them Meap V01 Chapters 1 To 4 Of 14 ...
Supporting SQLserver
Sql For Ibm I A Database Modernization Guide None Rafael Victriapereira
Ad

Recently uploaded (20)

PDF
Microsoft Core Cloud Services powerpoint
PPTX
retention in jsjsksksksnbsndjddjdnFPD.pptx
PDF
Tetra Pak Index 2023 - The future of health and nutrition - Full report.pdf
PDF
Jean-Georges Perrin - Spark in Action, Second Edition (2020, Manning Publicat...
PPTX
FMIS 108 and AISlaudon_mis17_ppt_ch11.pptx
PDF
Data Engineering Interview Questions & Answers Cloud Data Stacks (AWS, Azure,...
PDF
Votre score augmente si vous choisissez une catégorie et que vous rédigez une...
PPTX
Lesson-01intheselfoflifeofthekennyrogersoftheunderstandoftheunderstanded
PDF
Navigating the Thai Supplements Landscape.pdf
PPTX
QUANTUM_COMPUTING_AND_ITS_POTENTIAL_APPLICATIONS[2].pptx
PPTX
Introduction to Inferential Statistics.pptx
PPTX
Managing Community Partner Relationships
PPTX
A Complete Guide to Streamlining Business Processes
PPTX
STERILIZATION AND DISINFECTION-1.ppthhhbx
PDF
Systems Analysis and Design, 12th Edition by Scott Tilley Test Bank.pdf
PPTX
CYBER SECURITY the Next Warefare Tactics
PPTX
chrmotography.pptx food anaylysis techni
PDF
Data Engineering Interview Questions & Answers Batch Processing (Spark, Hadoo...
PPT
DU, AIS, Big Data and Data Analytics.ppt
PPTX
Leprosy and NLEP programme community medicine
Microsoft Core Cloud Services powerpoint
retention in jsjsksksksnbsndjddjdnFPD.pptx
Tetra Pak Index 2023 - The future of health and nutrition - Full report.pdf
Jean-Georges Perrin - Spark in Action, Second Edition (2020, Manning Publicat...
FMIS 108 and AISlaudon_mis17_ppt_ch11.pptx
Data Engineering Interview Questions & Answers Cloud Data Stacks (AWS, Azure,...
Votre score augmente si vous choisissez une catégorie et que vous rédigez une...
Lesson-01intheselfoflifeofthekennyrogersoftheunderstandoftheunderstanded
Navigating the Thai Supplements Landscape.pdf
QUANTUM_COMPUTING_AND_ITS_POTENTIAL_APPLICATIONS[2].pptx
Introduction to Inferential Statistics.pptx
Managing Community Partner Relationships
A Complete Guide to Streamlining Business Processes
STERILIZATION AND DISINFECTION-1.ppthhhbx
Systems Analysis and Design, 12th Edition by Scott Tilley Test Bank.pdf
CYBER SECURITY the Next Warefare Tactics
chrmotography.pptx food anaylysis techni
Data Engineering Interview Questions & Answers Batch Processing (Spark, Hadoo...
DU, AIS, Big Data and Data Analytics.ppt
Leprosy and NLEP programme community medicine

Stop Bad Data in its OLTP Tracks

  • 1. Stop Bad Data in its OLTP Tracks Denise McInerney Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney
  • 2. Agenda Topics  What is “bad” data?  Table design  NULL pitfalls  Constraints: friend or foe?  Hardcoding  Transactions  Garbage in  Testing  Change Management & Controls Silicon Valley SQL Server Users Group June 19, 2012 2Copyright © 2012 Denise McInerney
  • 3. Who am I? • SQL Server DBA since 1998  Web-based OLTP applications  Focus on design and performance tuning • Staff DBA Intuit • Director, PASS Board • Virtual Chapters • Women in Tech VC • Contact me:  denise.mcinerney@sqlpass.org  denise_mcinerney@intuit.com  @denisemc06 Copyright © 2012 Denise McInerney 3 Silicon Valley SQL Server Users Group June 19, 2012
  • 4. My Framework  DBA = data steward  Backups, security—what about quality?  DBA <> Developer  Don‟t count on ETL for everything Silicon Valley SQL Server Users Group June 19, 2012 4Copyright © 2012 Denise McInerney
  • 5. Define “bad” data  Inaccurate  Missing  Misleading  Causes bugs  Breaks reports  Can compromise security  Impacts customers  Impacts business Silicon Valley SQL Server Users Group June 19, 2012 5Copyright © 2012 Denise McInerney
  • 6. Design  Have one—even in an “agile” shop  It‟s a system, not a collection of tables  Don‟t be lazy  Bad design invites bad data Silicon Valley SQL Server Users Group June 19, 2012 6Copyright © 2012 Denise McInerney
  • 7. Design Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney 7
  • 8. Bad Design Examples Silicon Valley SQL Server Users Group June 19, 2012 8Copyright © 2012 Denise McInerney
  • 9. Pitfalls of NULL  What is NULL?  Missing data  Unknown in comparisons  NULL <> „‟ or “”  NULL <> 0  NULL can be valid  But application can‟t handle it Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney 9
  • 10. NULL Examples Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney 10
  • 11. Constraints: Your Frenemies  CHECK  INSERT/UPDATE fails if condition evaluates to FALSE  Comparisons to NULL result in unknown  Can use to enforce logic, business rules  DEFAULT  Can prevent some bugs  Won‟t solve all your problems  Can be “forgotten”  100% of records have default value Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney 11
  • 12. Constraint Examples Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney 12
  • 13. Hardcoding Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney 13
  • 14. Transactions  Understand them  Don‟t assume others understand them  BEGIN TRAN…COMMIT TRAN is not enough  Failed INSERT…the silent killer Silicon Valley SQL Server Users Group June 19, 2012 14Copyright © 2012 Denise McInerney
  • 15. Transactions Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney 15
  • 16. Garbage In  Many ways things go wrong  Concatenation  Recycled identifiers  Duplicates  Honor the schema  Be consistent  Fix it on the way in Silicon Valley SQL Server Users Group June 19, 2012 16Copyright © 2012 Denise McInerney
  • 17. Garbage In Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney 17
  • 18. Testing  Database is not exempt  Not just the happy path  Look at the data!  People  Machines Silicon Valley SQL Server Users Group June 19, 2012 18Copyright © 2012 Denise McInerney
  • 19. Change Control  Lots of ways data gets IN  Code—application & SQL  Version control & Management  Scripts  GUI (!)  People  Everyone takes short cuts  Every check-in potential data bug Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney 19
  • 20. There is no “I” in “Bad Data” Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney 20
  • 21. Pessimism Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney 21
  • 22. Vigilance Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney 22
  • 23. Summary  DBA‟s job to guard data quality  Design, Plan, Process, Controls  Engage Others  Keep your guard up Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney 23
  • 24. Q & A Silicon Valley SQL Server Users Group June 19, 2012 Copyright © 2012 Denise McInerney 24