SlideShare a Scribd company logo
1 of 35
Richie Rump
    Jorriss LLC
      @Jorriss
www.jorriss.net
• Think of your database as your
  application foundation.
• The more time you spend on your
  foundation the better your application
  will be.
• If you get the foundation wrong you WILL
  have problems.
• Databases are highly complex systems.
• SQL Server has over twenty years of
  development.
• Learning SQL Server is like Alice’s rabbit
  hole. It keeps going down.
• Leverage your DBAs experience and
  knowledge of SQL Server.
When they do SELECT * because it’s easier
   than naming the fields they need
Source: http://dbareactions.tumblr.com/post/41716132853/when-they-do-
select-because-its-easier-than
When I see cursors written in new code

Source: http://dbareactions.tumblr.com/post/41643855887/when-i-see-cursors-
written-in-new-code
When the job applicant can’t code FizzBuzz
          during the interview
Source: http://dbareactions.tumblr.com/post/40938657699/when-the-job-
applicant-cant-code-fizzbuzz-during
•   Single Table
•   Wrong Types
•   No Indexes on Foreign Keys
•   Entity Attribute Value pattern
•   Guids
•   Surrogate Key / No Alternate Key
• All data is in one table
• Database Normalization is ignored.
• Redundant data everywhere
• Simple updates become complex
• Database changes become more
  frequent.
• Index strategy become messy
• Having the wrong data types can create
  long lasting issues.
• T-SQL can become challenging and
  inefficient.
• Understanding the differences between
  data types
• Better information, better decisions.
• CHAR
 – Fixed length. Value will be padded with spaces.
 – Size n bytes.
 – 1 – 8000 characters.
• VARCHAR
 – Variable length.
 – The storage size is the actual length of the data
   entered + 2 bytes.
 – 1 – 8000 characters.
• Holds UNICODE data.
• NCHAR
  – 1 – 4000 characters
  – Storage size twice n characters.
• NVARCHAR
  – 1 – 4000 character
  – Storage size twice n characters + 2 bytes.
• MAX allows a column size of 2GB.
• Cannot create an index on MAX columns
• REPEAT: Cannot create an index on MAX
  columns
• DATETIME
  – Accuracy rounded to .000, .003, or .007 second.
  – 8 Bytes
• DATETIME2 (n)
  – Accuracy to .0000001 second
  – 6 bytes for precisions less than 3;
  – 7 bytes for precisions 3 and 4.
  – All other precisions require 8 bytes.
• SMALLDATETIME
  – Accuracy to the minute.
  – No seconds
  – 4 bytes
• Demo
• BIGINT
  – -9,223,372,036,854,775,808 to
    9,223,372,036,854,775,807
  – Size 8 bytes
• INT
  – -2,147,483,648 to 2,147,483,647
  – Size 4 bytes
• SMALLINT
  – -32,768 to 32,767
  – Size 2 bytes
• TINYINT
  – 0 to 255
  – Size 1 bytes
• Size matters
• Put the extra time to size it correctly
• Don’t forget indexes store data on disk
• BIT
  – Values can be 0 or 1 (or NULL)
  – Size 1 byte
• TINYINT
  – Values can be 0 to 255
  – Size 1 byte
• Factor in your data access into your decision.
• May slow queries with JOINs
• Will have a performance impact on
  DELETEs
• Demo
Person
Entity ID          Name
1                  Cecil Phillip


Person_Attribute
Attribute ID   Entity ID           Attribute Type   Value
100            1                   Phone Number     305-555-9607
101            1                   Age              30
102            1                   Birthdate        2/9/1983
• No Data Type Enforcement
Person
Entity ID          Name
1                  Cecil Phillip


Person_Attribute
Attribute ID   Entity ID           Attribute Type   Value
100            1                   Phone Number     305-555-9607
101            1                   Age              501
102            1                   Birthdate        Yes I have one
• No NOT NULL Enforcement
Person
Entity ID          Name
1                  Cecil Phillip


Person_Attribute
Attribute ID   Entity ID           Attribute Type   Value
100            1                   Phone Number     NULL
101            1                   Age              30
102            1                   Birthdate        2/9/1983
• Querying much harder
• Demo…
• You would think this wouldn’t be a
  problem…
• Some benefits
  – Portable
  – Id can be generated from the app
  – That’s about it.
The problems:
• Size
  – Guids 16 bytes
  – Int 4 bytes
  – Disk and Memory
• Fragmentation
Source: http://blog.sqlauthority.com/2010/01/12/sql-server-
fragmentation-detect-fragmentation-and-eliminate-fragmentation/
A partial solution:
• NEWSEQUENTIALID()
  – Creates a sequential GUID.
  – Minimizes fragmentation
  – Still have the space issue.
• A surrogate key is a primary key
  automatically generated
• Surrogate keys are good thing.
• BUT when alternate key isn’t defined bad
  things can happen…bad things man, bad
  things.
• Demo…
• Data Model Resource Book vol 1-3
  Len Silverston
• Pro SQL Server 2012 Relational
  Database Design and Implementation
  Louis Davidson, Jessica Moss
Richie Rump
@Jorriss
http://jorriss.net
http://slideshare.net/jorriss
http://dotnetmiami.com

More Related Content

Similar to Database Design Disasters

Dama - Protecting Sensitive Data on a Database
Dama - Protecting Sensitive Data on a DatabaseDama - Protecting Sensitive Data on a Database
Dama - Protecting Sensitive Data on a Databasejohanswart1234
 
03 AFCU - ITSM Seattle final
03 AFCU - ITSM Seattle final03 AFCU - ITSM Seattle final
03 AFCU - ITSM Seattle finalJared Flanders
 
Fix What Matters: A Data Driven Approach to Vulnerability Management
Fix What Matters: A Data Driven Approach to Vulnerability ManagementFix What Matters: A Data Driven Approach to Vulnerability Management
Fix What Matters: A Data Driven Approach to Vulnerability ManagementMichael Roytman
 
Blitzing with your defense bea con
Blitzing with your defense bea conBlitzing with your defense bea con
Blitzing with your defense bea conInnismir
 
Dmk sb2010 web_defense
Dmk sb2010 web_defenseDmk sb2010 web_defense
Dmk sb2010 web_defenseDan Kaminsky
 
CISSP-Certified.pptx
CISSP-Certified.pptxCISSP-Certified.pptx
CISSP-Certified.pptxssuser645549
 
Introduction to LavaPasswordFactory
Introduction to LavaPasswordFactoryIntroduction to LavaPasswordFactory
Introduction to LavaPasswordFactoryChristopher Grayson
 
Personal Digital Security 101
Personal Digital Security 101Personal Digital Security 101
Personal Digital Security 101Derek Banks
 
Basic Security for Digital Companies - #MarketersUnbound (2014)
Basic Security for Digital Companies - #MarketersUnbound (2014)Basic Security for Digital Companies - #MarketersUnbound (2014)
Basic Security for Digital Companies - #MarketersUnbound (2014)Justin Bull
 
Hunt for the red DA
Hunt for the red DAHunt for the red DA
Hunt for the red DANeil Lines
 
OISC2013_Presentation
OISC2013_PresentationOISC2013_Presentation
OISC2013_PresentationAustin Nagel
 
Protecting privacy with fuzzy-feeling test data
Protecting privacy with fuzzy-feeling test dataProtecting privacy with fuzzy-feeling test data
Protecting privacy with fuzzy-feeling test dataMatt Bowen
 
SOCs for the rest of us
SOCs for the rest of usSOCs for the rest of us
SOCs for the rest of usRyan Kovar
 
Sitecore Symposium 2018 Theater Presentation - Shrink Your Workload, Grow You...
Sitecore Symposium 2018 Theater Presentation - Shrink Your Workload, Grow You...Sitecore Symposium 2018 Theater Presentation - Shrink Your Workload, Grow You...
Sitecore Symposium 2018 Theater Presentation - Shrink Your Workload, Grow You...Mark Stiles
 
Neo4j Training Modeling
Neo4j Training ModelingNeo4j Training Modeling
Neo4j Training ModelingMax De Marzi
 

Similar to Database Design Disasters (20)

Black opspki 2
Black opspki 2Black opspki 2
Black opspki 2
 
Dama - Protecting Sensitive Data on a Database
Dama - Protecting Sensitive Data on a DatabaseDama - Protecting Sensitive Data on a Database
Dama - Protecting Sensitive Data on a Database
 
Osint
OsintOsint
Osint
 
03 AFCU - ITSM Seattle final
03 AFCU - ITSM Seattle final03 AFCU - ITSM Seattle final
03 AFCU - ITSM Seattle final
 
Fix What Matters: A Data Driven Approach to Vulnerability Management
Fix What Matters: A Data Driven Approach to Vulnerability ManagementFix What Matters: A Data Driven Approach to Vulnerability Management
Fix What Matters: A Data Driven Approach to Vulnerability Management
 
Blitzing with your defense bea con
Blitzing with your defense bea conBlitzing with your defense bea con
Blitzing with your defense bea con
 
Dmk sb2010 web_defense
Dmk sb2010 web_defenseDmk sb2010 web_defense
Dmk sb2010 web_defense
 
CISSP-Certified.pptx
CISSP-Certified.pptxCISSP-Certified.pptx
CISSP-Certified.pptx
 
Introduction to LavaPasswordFactory
Introduction to LavaPasswordFactoryIntroduction to LavaPasswordFactory
Introduction to LavaPasswordFactory
 
Personal Digital Security 101
Personal Digital Security 101Personal Digital Security 101
Personal Digital Security 101
 
Basic Security for Digital Companies - #MarketersUnbound (2014)
Basic Security for Digital Companies - #MarketersUnbound (2014)Basic Security for Digital Companies - #MarketersUnbound (2014)
Basic Security for Digital Companies - #MarketersUnbound (2014)
 
Passwords
PasswordsPasswords
Passwords
 
Network or perish
Network or perishNetwork or perish
Network or perish
 
Hunt for the red DA
Hunt for the red DAHunt for the red DA
Hunt for the red DA
 
OISC2013_Presentation
OISC2013_PresentationOISC2013_Presentation
OISC2013_Presentation
 
Protecting privacy with fuzzy-feeling test data
Protecting privacy with fuzzy-feeling test dataProtecting privacy with fuzzy-feeling test data
Protecting privacy with fuzzy-feeling test data
 
SOCs for the rest of us
SOCs for the rest of usSOCs for the rest of us
SOCs for the rest of us
 
Cyber Security
Cyber SecurityCyber Security
Cyber Security
 
Sitecore Symposium 2018 Theater Presentation - Shrink Your Workload, Grow You...
Sitecore Symposium 2018 Theater Presentation - Shrink Your Workload, Grow You...Sitecore Symposium 2018 Theater Presentation - Shrink Your Workload, Grow You...
Sitecore Symposium 2018 Theater Presentation - Shrink Your Workload, Grow You...
 
Neo4j Training Modeling
Neo4j Training ModelingNeo4j Training Modeling
Neo4j Training Modeling
 

Recently uploaded

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Recently uploaded (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

Database Design Disasters

  • 1. Richie Rump Jorriss LLC @Jorriss www.jorriss.net
  • 2.
  • 3. • Think of your database as your application foundation. • The more time you spend on your foundation the better your application will be. • If you get the foundation wrong you WILL have problems.
  • 4. • Databases are highly complex systems. • SQL Server has over twenty years of development. • Learning SQL Server is like Alice’s rabbit hole. It keeps going down. • Leverage your DBAs experience and knowledge of SQL Server.
  • 5. When they do SELECT * because it’s easier than naming the fields they need Source: http://dbareactions.tumblr.com/post/41716132853/when-they-do- select-because-its-easier-than
  • 6. When I see cursors written in new code Source: http://dbareactions.tumblr.com/post/41643855887/when-i-see-cursors- written-in-new-code
  • 7. When the job applicant can’t code FizzBuzz during the interview Source: http://dbareactions.tumblr.com/post/40938657699/when-the-job- applicant-cant-code-fizzbuzz-during
  • 8. Single Table • Wrong Types • No Indexes on Foreign Keys • Entity Attribute Value pattern • Guids • Surrogate Key / No Alternate Key
  • 9. • All data is in one table • Database Normalization is ignored. • Redundant data everywhere • Simple updates become complex • Database changes become more frequent. • Index strategy become messy
  • 10.
  • 11. • Having the wrong data types can create long lasting issues. • T-SQL can become challenging and inefficient. • Understanding the differences between data types • Better information, better decisions.
  • 12. • CHAR – Fixed length. Value will be padded with spaces. – Size n bytes. – 1 – 8000 characters. • VARCHAR – Variable length. – The storage size is the actual length of the data entered + 2 bytes. – 1 – 8000 characters.
  • 13. • Holds UNICODE data. • NCHAR – 1 – 4000 characters – Storage size twice n characters. • NVARCHAR – 1 – 4000 character – Storage size twice n characters + 2 bytes.
  • 14. • MAX allows a column size of 2GB. • Cannot create an index on MAX columns • REPEAT: Cannot create an index on MAX columns
  • 15. • DATETIME – Accuracy rounded to .000, .003, or .007 second. – 8 Bytes • DATETIME2 (n) – Accuracy to .0000001 second – 6 bytes for precisions less than 3; – 7 bytes for precisions 3 and 4. – All other precisions require 8 bytes.
  • 16. • SMALLDATETIME – Accuracy to the minute. – No seconds – 4 bytes • Demo
  • 17. • BIGINT – -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 – Size 8 bytes • INT – -2,147,483,648 to 2,147,483,647 – Size 4 bytes
  • 18. • SMALLINT – -32,768 to 32,767 – Size 2 bytes • TINYINT – 0 to 255 – Size 1 bytes
  • 19. • Size matters • Put the extra time to size it correctly • Don’t forget indexes store data on disk
  • 20. • BIT – Values can be 0 or 1 (or NULL) – Size 1 byte • TINYINT – Values can be 0 to 255 – Size 1 byte • Factor in your data access into your decision.
  • 21. • May slow queries with JOINs • Will have a performance impact on DELETEs • Demo
  • 22.
  • 23.
  • 24. Person Entity ID Name 1 Cecil Phillip Person_Attribute Attribute ID Entity ID Attribute Type Value 100 1 Phone Number 305-555-9607 101 1 Age 30 102 1 Birthdate 2/9/1983
  • 25. • No Data Type Enforcement Person Entity ID Name 1 Cecil Phillip Person_Attribute Attribute ID Entity ID Attribute Type Value 100 1 Phone Number 305-555-9607 101 1 Age 501 102 1 Birthdate Yes I have one
  • 26. • No NOT NULL Enforcement Person Entity ID Name 1 Cecil Phillip Person_Attribute Attribute ID Entity ID Attribute Type Value 100 1 Phone Number NULL 101 1 Age 30 102 1 Birthdate 2/9/1983
  • 27. • Querying much harder • Demo…
  • 28. • You would think this wouldn’t be a problem… • Some benefits – Portable – Id can be generated from the app – That’s about it.
  • 29. The problems: • Size – Guids 16 bytes – Int 4 bytes – Disk and Memory • Fragmentation
  • 31.
  • 32. A partial solution: • NEWSEQUENTIALID() – Creates a sequential GUID. – Minimizes fragmentation – Still have the space issue.
  • 33. • A surrogate key is a primary key automatically generated • Surrogate keys are good thing. • BUT when alternate key isn’t defined bad things can happen…bad things man, bad things. • Demo…
  • 34. • Data Model Resource Book vol 1-3 Len Silverston • Pro SQL Server 2012 Relational Database Design and Implementation Louis Davidson, Jessica Moss