5 physical data modeling blunders 09092010

31
Physical Data Modeling Blunders And How to Avoid Them Karen Lopez Sr. Project Manager

Upload: erwin-modeling

Post on 24-Jan-2015

664 views

Category:

Technology


2 download

DESCRIPTION

 

TRANSCRIPT

Page 1: 5 physical data modeling blunders 09092010

Physical Data Modeling BlundersAnd How to Avoid Them

Karen Lopez

Sr. Project Manager

Page 2: 5 physical data modeling blunders 09092010

PAGE 2

Abstract

What’s going on in your physical data model? How many people can or will update it to match the reality of what’s going on in your databases? Who decides what goes into the physical model? In this presentation we discuss 5 physical data modeling mistakes that cost you dearly: performance snags, development delays, bugs and professional respect. Data Architects are often tasked to prepare first-cut physical data models, yet these skills usually overlap those of DBAs and Developers and this overlap can lead to contention, confusion, and complacency.

With this presentation, you’ll learn about the 5 blunders, how to find them, plus many tips on how to avoid them.

Page 3: 5 physical data modeling blunders 09092010

PAGE 3

Speaker Bio

Karen López is a principal consultant at InfoAdvisors. She specializes in the practical application of data management principles. Karen is also the ListMistress and moderator of the InfoAdvisors Discussion Groups at www.infoadvisors.com and other online communities.

Page 4: 5 physical data modeling blunders 09092010

PAGE 4

Agenda

The Problem

Blunders, FAILs, D’Oh’s, Faults and WTHs?

10 Tips

Page 5: 5 physical data modeling blunders 09092010

POLL: Who Are You?

Page 6: 5 physical data modeling blunders 09092010

POLL: Physical Model Much?

Page 7: 5 physical data modeling blunders 09092010

PAGE 7

The Problem

Page 8: 5 physical data modeling blunders 09092010

PAGE 8

Assuming Numbers are Numbers

Confirmation

Number

Page 9: 5 physical data modeling blunders 09092010

PAGE 9

D’OH!

•Leading Zeros

•Non-Numeric

•Special Characters

•Sorting Issues

•Externally Managed Numbers

Page 10: 5 physical data modeling blunders 09092010

PAGE 10

Avoid it

1. Use a numeric-ish datatype when there’s math involved.

2. Do your research

3. If it’s externally managed data, its format or composition could change at any time. Anticipate that.

4. Anticipate leading zeros.

5. Anticipate significant formatting, characters & other tricks.

Page 11: 5 physical data modeling blunders 09092010

PAGE 11

Choosing the Wrong Primary Key

Page 12: 5 physical data modeling blunders 09092010

PAGE 12

32 + 8 + 32 + 32 + (0 to 22) = A really big key

that only a Data Architect could love

Page 13: 5 physical data modeling blunders 09092010

PAGE 13

Avoid it

• Establish Primary Key standards and styles

• Smaller PKs lead to smaller indexes and smaller databases. Take advantage of that

• Choose PKs that do not change when data changes

• Understand how Identity columns work

Page 14: 5 physical data modeling blunders 09092010

PAGE 14

Applying Surrogate Keys Incorrectly

Page 15: 5 physical data modeling blunders 09092010

PAGE 15

Applying a Surrogate Key

Page 16: 5 physical data modeling blunders 09092010

PAGE 16

WTH?

Page 17: 5 physical data modeling blunders 09092010

PAGE 17

Alternate Key

Page 18: 5 physical data modeling blunders 09092010

PAGE 18

Avoid it

• Establish Primary Key standards and styles

• Smaller PKs lead to smaller indexes and smaller databases. Take advantage of that.

• Don’t forget the Business Key

• Choose PKs that do not change when data changes

• Understand how Identity columns work

Page 19: 5 physical data modeling blunders 09092010

PAGE 19

Turning off RI for Development

Page 20: 5 physical data modeling blunders 09092010

PAGE 20

Blunder

Page 21: 5 physical data modeling blunders 09092010

PAGE 21

RI = FK

Page 22: 5 physical data modeling blunders 09092010

PAGE 22

Avoid it

• Educate team on the risks & nearly universal outcome of turning off RI

• Generate RI in every script

• Develop test data

• Develop scripts for loading data

• Ensure team has easy access to Data Models

Page 23: 5 physical data modeling blunders 09092010

PAGE 23

Using the Defaults

Page 24: 5 physical data modeling blunders 09092010

PAGE 24

Defaults

• Defaults <> Best Practices

• Product Defaults aren’t YOUR defaults

• Defaults might even be…faulty.

Page 25: 5 physical data modeling blunders 09092010

PAGE 25

Defaulting Faults

Page 26: 5 physical data modeling blunders 09092010

PAGE 26

Avoid it

• Create a DA Test database…and use it.

• Test Generation Options to Test DB with Data

• Generate Test Scripts, Varying Options

• Review options with DBAs and Developers.

• Choose Defaults, don’t default them

• Save your Default Set

Page 27: 5 physical data modeling blunders 09092010

PAGE 27

• Using the wrong tool• Too much Subtyping• Logical Flexible hierarchies• Wrong Datatypes• Dual updates• Forgetting to manage the data• Duplicate Indexes• Ignoring Clustering• Using overly generic design

patterns• Column order• Silly Long Names• Failing to compare

• Hand generating scripts• Failing to report issues• Denormalizing too soon• Failing to use constraints• Making performance more

important than integrity• Completely separate logical

model• Failing to take into account

whole environment.• Applying surrogate keys where

they have no business• Not testing your design• Ignoring reference data design

Other Blunders

Page 28: 5 physical data modeling blunders 09092010

PAGE 28

10 Tips for Avoiding Physical Modeling Blunders

1. Understand cost, benefit and risk

2. Get formal training on target technologies

3. Work near your DBAs and Developers

4. Ask DBAs about trade-offs, not just solutions

5. Build portfolio of performance vs. integrity trade-offs

Page 29: 5 physical data modeling blunders 09092010

PAGE 29

10 Tips for Avoiding Physical Modeling Blunders

6. Profile Source Data

7. Build Test Databases, with Data

8. Test Scripts

9. Compare, Compare, Compare…then Compare some More.

10.Get More Training.

Page 30: 5 physical data modeling blunders 09092010

PAGE 30

Summary 1.Don’t assume that

numbers are….numbers

2.Choose the right primary

key

3.Apply surrogate keys

correctly

4.Keep RI turned on

5.Architect, don’t default

Page 31: 5 physical data modeling blunders 09092010

PAGE 31

Questions?

[email protected]

Feedback, questions,

comments are always

appreciated.

http://www.speakerrate.com/karenlopez