SlideShare a Scribd company logo
Karen Lopez @datachick #TeamData
THE KEY TO KEYS
PRIMARY ALTERNATE IDENTITY UNIQUE CLUSTERED SEQUENCE SURROGATE CLUTTERED
FOREIGN MEANINGLESS HASH ROWIDENTIFIER ROWID LOOKUP SEARCH PK FK GUID BUSINESS
IDENTIFIER PROPERTY CONSTRAINT INDEX
Spotthestation.nasa.gov
YES, PLEASE DO
TWEET/SHARE TODAY’S
EVENT
@DATACHICK #TEAMDATA
KAREN LÓPEZ
Karen has 20+ years of data and information architecture
experience on large, multi-project programs.
She is a frequent speaker on data modeling, data-driven
methodologies and pattern data models.
She wants you to love your data…
She is loves new tech and gadgets
WHO ARE YOU?
So many terms and
jargon in talking about
database stuff
WHY THIS TOPIC?
Modeling
Vocabulary
Database
Vocabulary
Vendor
Vocabulary
Slang &
Jargon
KAREN SAYS: KEYS
1. Keys are Key to performance
AND data quality
2. Concepts can have many
ways to implement
3. Not all data modeling
vendors use the same terms
4. Not all database vendors use
are the same
If only there was a
profession that specialized
in giving thing standard
names
TODAY’S FOCUS
Entities and
Tables
Attributes and
Columns
Database objects that
implement or enforce key-
related stuff
ONE MORE THING… KEYS ARE KEY!
Keys
(Identifiers)
play a role
that many
modelers &
designers
forget:
They form part of the semantics of our
models.
Primary keys are used in enforcing
constraints on data quality
Primary keys are not just about
performance.
Is all about the keys, ‘bout the keys, ‘bout the keys…
Depends on understanding the MEANING of the keys and
columns
Goes all to heck* when you have surrogate keys
Depends on the make up of the key parts (columns)
NORMALIZATION
3NF
Every fact is either part of a key or depends
upon the key, the whole key, and nothing but the
key.
….so help you Codd
Michael J Swart
LINGO, JARGON AND TERMS
WE ARE LOUSY AT STANDARDIZING THESE THINGS
TYPES OF KEY VOCABULARIES
Terms used conceptually
• Primary key
• Alternate key
• Composite key
• Super key
• Candidate key
• Surrogate key
• …
Terms used physically
• Primary key
• Clustered key
• Encryption key
• Partitioning key
• Index
• Identity
• Sequence
PRIMARY
16
Sequence
Alternate
Composite
Candidate
Identity
Numeric
Lookup
Cluttered
Clustered
Natural
Business
Logical
Encryption
Index
Duplicate
Foreign
Constraint
Partitioning
Super
Unique
Compound
Surrogate
GUID
AT THE BEGINNING
Business
Key
Logical Key Natural Key
CLOSER TO DESIGN…
Super Key
Candidate
Key
Primary
Key
Alternate
Key
Foreign Key
PRIMARY KEY CRITERIA
Applicable to all instances
(Mandatory)
Unique
Stable
Small
The first two are required by
the Relational Model.
3 and 4 required by good
practice. But they are not
required in data modeling.
Modelers should, however, live
in the real world most of the
time and observe them
ALTERNATE KEYS
Unique Mandatory
Might
Change
Unique
Constraint
Unique
Index
MORE TERMS
Cluttered
key
Composite
key
Compound
key
MORE TERMS
Surrogate
Key
Identity Sequence GUID Custom
SURROGATE KEYS
The Key to Keys - Database Design
IDENTITY/IDENTITY PROPERTY
Issue: How people use them
255
32,767
9,223,372,036,854,775,807
2,147,483,647
IDENTITY [ (seed , increment) ]
IDENTITIES
Issue: How people monitor them
IDENTITY [ (seed , increment) ]
AD-322-S
HOW DO YOU FIX IT IF IT’S ALREADY GONE OFF?
RESEED
GAPS
Not UNIQUE?
Change DataType
WHAT ABOUT SEQUENCES?
CREATE SEQUENCE [schema_name . ] sequence_name
[ AS [ built_in_integer_type | user-defined_integer_type ] ]
[ START WITH <constant> ]
[ INCREMENT BY <constant> ]
[ { MINVALUE [ <constant> ] } | { NOMINVALUE } ]
[ { MAXVALUE
[ <constant> ] } | { NOMAXVALUE } ]
[ CYCLE | { NOCYCLE } ]
[ { CACHE [ <constant> ] } | { NO CACHE } ]
[ ; ]
RESTART
ALTER SEQUENCE [schema_name. ] sequence_name
[ RESTART [ WITH <constant> ] ]
[ INCREMENT BY <constant> ]
[ { MINVALUE <constant> } | { NO MINVALUE } ] [ { MAXVALUE <constant> }
| { NO MAXVALUE } ]
[ CYCLE | { NO CYCLE } ] [ { CACHE [ <constant> ] } | { NO CACHE } ]
[ ; ]
AD-322-S
HOW DO YOU FIX IT IF IT’S ALREADY GONE OFF?
RESTART
GAPS
Not UNIQUE?
Change DataType
HOW DO YOU PREVENT IT?
Proper Design
Do the math
SEED Value
Increment Value
Use another feature
Monitor
Max allowable value
Max current value
Gaps
Predict* countdown timer
Team Data Script
Know your hottest tables
Prioritize
http://thomaslarock.com/2015/11/sql-server-identity-values-check/
GUIDS
16 bytes
Universally unique
Many per table
3F2504E0-4F89-41D3-9A0C-0305E82C3301
MORE TERMS
Numeric Integer BIG Integer
Small
number
MORE TERMS
Clustered
Key
Partitioning
Key
MORE TERMS
Index Constraint
Application
code
Referential
Integrity
HOW EASY IS THIS?
“Just allocate a surrogate key for every table”
Job done.
And why do we need data modelers/designers?
WHAT YOU SHOULD DO:
Read Up
Ensure you
use correct
terms
Understand
how your
tools create
and
generate
keys
Learn
about the
Outliers
Set the
standard
for correct
term use
THANK YOU, YOU WERE GREAT.
KAREN LOPEZ @DATACHICK

More Related Content

PDF
Some NoSQL
PPTX
Running Natural Language Queries on MongoDB
PPTX
Data Modeling for Security, Privacy and Data Protection
PPTX
NoSQL Tel Aviv Meetup#1: NoSQL Data Modeling
PPT
Schemaless Databases
PDF
Model Behavior: An Introduction to Data Models
PPTX
SQL vs NoSQL
PPTX
Teri Grossheim - Amazon Presentation
Some NoSQL
Running Natural Language Queries on MongoDB
Data Modeling for Security, Privacy and Data Protection
NoSQL Tel Aviv Meetup#1: NoSQL Data Modeling
Schemaless Databases
Model Behavior: An Introduction to Data Models
SQL vs NoSQL
Teri Grossheim - Amazon Presentation

What's hot (20)

PDF
7 Dangerous Myths DBAs Believe about Data Modeling
PDF
Haystacks slides
PDF
My sql vs mongo
PPTX
Dapper: the microORM that will change your life
PDF
SAP PowerDesigner Masterclass for the UK SAP Database & Technology User Group...
PDF
Graph Data Modeling in DataStax Enterprise
PPTX
Mongodb vs mysql
PDF
Getting to Real-Time in a Multi-Model Architecture
PPTX
Interleaving, Evaluation to Self-learning Search @904Labs
PPTX
SlamData - How MongoDB Is Powering a Revolution in Visual Analytics
PPTX
Evolution of the DBA to Data Platform Administrator/Specialist
PDF
Analytics with SAS
DOCX
Nagendra Resume
PDF
Jakarta EE Meets NoSQL in the Cloud Age [DEV6109]
PDF
Neo4j Training Cypher
PDF
Eclipse JNoSQL: One API to Many NoSQL Databases - BYOL [HOL5998]
PDF
Data modeling with neo4j tutorial
PPTX
Query-time Nonparametric Regression with Temporally Bounded Models - Patrick ...
PPTX
AcceleTest
PDF
Join 2017_Deep Dive_Smart Caching
7 Dangerous Myths DBAs Believe about Data Modeling
Haystacks slides
My sql vs mongo
Dapper: the microORM that will change your life
SAP PowerDesigner Masterclass for the UK SAP Database & Technology User Group...
Graph Data Modeling in DataStax Enterprise
Mongodb vs mysql
Getting to Real-Time in a Multi-Model Architecture
Interleaving, Evaluation to Self-learning Search @904Labs
SlamData - How MongoDB Is Powering a Revolution in Visual Analytics
Evolution of the DBA to Data Platform Administrator/Specialist
Analytics with SAS
Nagendra Resume
Jakarta EE Meets NoSQL in the Cloud Age [DEV6109]
Neo4j Training Cypher
Eclipse JNoSQL: One API to Many NoSQL Databases - BYOL [HOL5998]
Data modeling with neo4j tutorial
Query-time Nonparametric Regression with Temporally Bounded Models - Patrick ...
AcceleTest
Join 2017_Deep Dive_Smart Caching
Ad

Similar to The Key to Keys - Database Design (20)

PDF
Heart of Data Modeling Webinar: The Ticking Timebombs in Your Data Model
PPTX
Tdd is Dead, Long Live TDD
PPT
Getting Unstuck: Working with Legacy Code and Data
PPTX
Using Compass to Diagnose Performance Problems
PPTX
Using Compass to Diagnose Performance Problems in Your Cluster
PPTX
SQL Server Tips & Tricks
PDF
Rsqrd AI: How to Design a Reliable and Reproducible Pipeline
DOCX
Yeswanth-Resume
PPTX
Data Modelling for security and privacy PRAGUE.pptx
PDF
Building a New Platform for Customer Analytics
PPTX
Top 10 tips for Oracle performance (Updated April 2015)
PDF
Using neo4j for enterprise metadata requirements
PPTX
Karen Lopez 10 Physical Data Modeling Blunders
PDF
Building New Data Ecosystem for Customer Analytics, Strata + Hadoop World, 2016
PPTX
CA ERwin Data Modeler End User Presentation
PPT
Intro to DSAA.ppt
PPTX
Karen's Favourite Features of SQL Server 2016
PDF
Data Management for High Performance Analytics
PPTX
Lesson5-Algorithms-Flowcharts-DataTypes-Pseudocode.pptx
PPTX
OLAP on the Cloud with Azure Databricks and Azure Synapse
Heart of Data Modeling Webinar: The Ticking Timebombs in Your Data Model
Tdd is Dead, Long Live TDD
Getting Unstuck: Working with Legacy Code and Data
Using Compass to Diagnose Performance Problems
Using Compass to Diagnose Performance Problems in Your Cluster
SQL Server Tips & Tricks
Rsqrd AI: How to Design a Reliable and Reproducible Pipeline
Yeswanth-Resume
Data Modelling for security and privacy PRAGUE.pptx
Building a New Platform for Customer Analytics
Top 10 tips for Oracle performance (Updated April 2015)
Using neo4j for enterprise metadata requirements
Karen Lopez 10 Physical Data Modeling Blunders
Building New Data Ecosystem for Customer Analytics, Strata + Hadoop World, 2016
CA ERwin Data Modeler End User Presentation
Intro to DSAA.ppt
Karen's Favourite Features of SQL Server 2016
Data Management for High Performance Analytics
Lesson5-Algorithms-Flowcharts-DataTypes-Pseudocode.pptx
OLAP on the Cloud with Azure Databricks and Azure Synapse
Ad

More from Karen Lopez (16)

PPTX
DGIQ East 2023 AI Ethics SIG
PPTX
A Designer's Favourite Security and Privacy Features in SQL Server and Azure ...
PPTX
Data in the Stars
PPTX
Designer's Favorite New Features in SQLServer
PDF
WhoseTinklingInYourDataLake - DAMA Chicago.pdf
PPTX
Expert Cloud Data Backup and Recovery Best Practice.pptx
PPTX
Manage Your Time So It Doesn't Manage You
PPTX
Migrating Data and Databases to Azure
PPTX
Blockchain for the DBA and Data Professional
PPTX
Blockchain for the DBA and Data Professional
PDF
Data Security and Protection in DevOps
PPTX
Fast Focus: SQL Server Graph Database & Processing
PPTX
Designing for Data Security by Karen Lopez
PPTX
How to Survive as a Data Architect in a Polyglot Database World
PPTX
7 Databases in 70 minutes
PPTX
NoSQL and Data Modeling for Data Modelers
DGIQ East 2023 AI Ethics SIG
A Designer's Favourite Security and Privacy Features in SQL Server and Azure ...
Data in the Stars
Designer's Favorite New Features in SQLServer
WhoseTinklingInYourDataLake - DAMA Chicago.pdf
Expert Cloud Data Backup and Recovery Best Practice.pptx
Manage Your Time So It Doesn't Manage You
Migrating Data and Databases to Azure
Blockchain for the DBA and Data Professional
Blockchain for the DBA and Data Professional
Data Security and Protection in DevOps
Fast Focus: SQL Server Graph Database & Processing
Designing for Data Security by Karen Lopez
How to Survive as a Data Architect in a Polyglot Database World
7 Databases in 70 minutes
NoSQL and Data Modeling for Data Modelers

Recently uploaded (20)

PPTX
CEE 2 REPORT G7.pptxbdbshjdgsgjgsjfiuhsd
PPTX
STUDY DESIGN details- Lt Col Maksud (21).pptx
PPTX
Business Acumen Training GuidePresentation.pptx
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
PDF
Taxes Foundatisdcsdcsdon Certificate.pdf
PPTX
Introduction to machine learning and Linear Models
PDF
Fluorescence-microscope_Botany_detailed content
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PDF
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
PDF
Foundation of Data Science unit number two notes
PPTX
Computer network topology notes for revision
PPT
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
PPTX
Moving the Public Sector (Government) to a Digital Adoption
PPTX
Introduction-to-Cloud-ComputingFinal.pptx
PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PPT
Miokarditis (Inflamasi pada Otot Jantung)
PDF
Lecture1 pattern recognition............
PPTX
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
PDF
.pdf is not working space design for the following data for the following dat...
CEE 2 REPORT G7.pptxbdbshjdgsgjgsjfiuhsd
STUDY DESIGN details- Lt Col Maksud (21).pptx
Business Acumen Training GuidePresentation.pptx
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
Taxes Foundatisdcsdcsdon Certificate.pdf
Introduction to machine learning and Linear Models
Fluorescence-microscope_Botany_detailed content
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
Foundation of Data Science unit number two notes
Computer network topology notes for revision
Chapter 3 METAL JOINING.pptnnnnnnnnnnnnn
Moving the Public Sector (Government) to a Digital Adoption
Introduction-to-Cloud-ComputingFinal.pptx
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
Miokarditis (Inflamasi pada Otot Jantung)
Lecture1 pattern recognition............
ALIMENTARY AND BILIARY CONDITIONS 3-1.pptx
.pdf is not working space design for the following data for the following dat...

The Key to Keys - Database Design