SlideShare una empresa de Scribd logo
1 de 31
Where Are My Keys? Ami Levin | CTO | DBSophic LTD
Session Goals A revisit to some of the fundamental design principals of relational databases: Normalization rules, key selection, and the controversies associated with these issues from a very practical, hands-on perspective, with special emphasis on some surprising performance issues that may arise from sub-optimal selection of keys...
The Forefathers
Normalization “A relation whose domains are all simple can be represented in storage by a two-dimensional column homogeneous array of the kind discussed above. Some more complicated data structure is necessary for a relation with one or more non-simple domains. For this reason (and others to be cited below) the possibility of eliminating non-simple domains appears worth investigating. There is, in fact, a very simple elimination procedure, which we shall call… normalization”
1st Normal Form There's no top-to-bottom or left-to-right ordering to the rows and columns There are no duplicate rows Every row-column intersection contains exactly one value All columns are regular
1st Normal Form
2nd Normal Form R is in 1st Normal Form (1NF). Given any candidate key K and any attribute A that is not a constituent of a candidate key, A depends upon the whole of K rather than just a part of it.
2nd Normal Form
3rd Normal Form R is in second normal form (2NF) Every non-prime attribute of R is non-transitively dependent on every candidate key of R. A transitive dependency is a functional dependency, in which X -> Z (X determines Z) indirectly, by virtue of X -> Y and Y -> Z.
3rd Normal Form
Keys Simple Composite 	 Candidate 	 Primary	 Artificial / Surrogate 	 Intelligent Natural
The Debate To ID or not to ID? IDENTITY (1,1) PK vs. Natural key
Pro Artificial In some cases, no natural key exists and an artificial key is the only option. Examples?
Pro Artificial Natural keys can change. Artificial keys never change. How Often? Cascading referential constraints Artificial keys can change
Pro Artificial Natural keys may become very long and complex. Get longer with each level 900 Bytes limit in SQL Server Multi-column Joins
Pro Artificial Artificial keys improve performance.  Simpler join predicates Ever increasing clustering effect Short keys = Smaller DB = Faster (?)
Pro Artificial Artificial keys reduce clustered index fragmentation.  All types of artificial keys? Minimize maintenance down time What about deletes? What about non-clustered indexes?
Pro Natural Natural keys have business meaning. Artificial keys are logically never queried for
Pro Natural Queries on tables using natural keys require fewer joins. The more familiar and meaningful the key, the less joins are required “Bypass” joins across levels
Pro Natural Data consistency is maintained explicitly when using natural keys. Artificial keys enable logical duplicates
Pro Natural Natural keys eliminate potential physical clustering performance issues. Contention for clustered regions
Less Mentioned Issues Artificial keys are the de-facto standard. ORM generate artificial keys LINQ doesn’t cache composite key rows
Less Mentioned Issues Data statistics and optimizations. Statistics on artificial keys are useless for parameter sniffing Selectivity estimations on composite key statistics are less accurate
Less Mentioned Issues Modularity and portability. Migration to other platforms Merging with other databases
Less Mentioned Issues Simplicity and aesthetics.
Demo Design Spec URL Country and city of owner Country ISO code needed by application Data consistency is crucial
Natural vs. Artificial DEMO
Ask Yourself… Is there a natural key that I can use as PK?  Are there a few natural candidates?  Which one is the simplest and most familiar? How stable is it? How will it be used logically? What will be the table physical usage patterns? What are the common query types for this table?
For More Information A Relational Model of Data for Large Shared Data Banksby E. F. CODD. The Relational Model for Database Management: Version 2 by E.F. Codd.  An introduction to database systemsby C.J Date.  Database in Depth: Relational Theory for Practitionersby C.J Date. The Database Relational Model: A Retrospective Review and Analysisby C.J Date. Joe Celko's Data and Databases: Concepts in Practice by Joe Celko. Joe Celko's SQL for Smarties, Fourth Edition: Advanced SQL Programmingby Joe Celko. Database Modeling and Design, Fifth Edition: Logical Designby Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, and H.V. Jagadish. Pro SQL Server 2008 Relational Database Design and Implementationby Louis Davidson, Kevin Kline, Scott Klein, and Kurt Windisch.
Where Are My Keys? Q&A
3   where are my keys - sql explore

Más contenido relacionado

La actualidad más candente

Database Design and Normalization
Database Design and NormalizationDatabase Design and Normalization
Database Design and NormalizationDave Kelleher
 
Concept Based Search
Concept Based SearchConcept Based Search
Concept Based Searchfreewi11
 
Relational Databases 2
Relational Databases 2Relational Databases 2
Relational Databases 2Jason Hando
 
Effective Unsupervised Matching of Product Titles
Effective Unsupervised Matching of Product TitlesEffective Unsupervised Matching of Product Titles
Effective Unsupervised Matching of Product TitlesLeonidas Akritidis
 
Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...
Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...
Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...Association for Computational Linguistics
 
SystemT: Declarative Information Extraction
SystemT: Declarative Information ExtractionSystemT: Declarative Information Extraction
SystemT: Declarative Information ExtractionYunyao Li
 
Object relationship mapping and hibernate
Object relationship mapping and hibernateObject relationship mapping and hibernate
Object relationship mapping and hibernateJoe Jacob
 
Wipro technical interview questions
Wipro technical interview questionsWipro technical interview questions
Wipro technical interview questionsPoonam Kherde
 

La actualidad más candente (16)

Notesparadigms
NotesparadigmsNotesparadigms
Notesparadigms
 
Database Design and Normalization
Database Design and NormalizationDatabase Design and Normalization
Database Design and Normalization
 
D4 Introduction to LINQ
D4 Introduction to LINQD4 Introduction to LINQ
D4 Introduction to LINQ
 
Concept Based Search
Concept Based SearchConcept Based Search
Concept Based Search
 
Dbms
DbmsDbms
Dbms
 
Relational Databases 2
Relational Databases 2Relational Databases 2
Relational Databases 2
 
Prolog ppt
Prolog pptProlog ppt
Prolog ppt
 
Computer sec2-1st term
Computer sec2-1st termComputer sec2-1st term
Computer sec2-1st term
 
Effective Unsupervised Matching of Product Titles
Effective Unsupervised Matching of Product TitlesEffective Unsupervised Matching of Product Titles
Effective Unsupervised Matching of Product Titles
 
Sec 2 1st term rev.
Sec 2  1st term rev.Sec 2  1st term rev.
Sec 2 1st term rev.
 
Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...
Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...
Zhongyuan Zhu - 2015 - Evaluating Neural Machine Translation in English-Japan...
 
Specs2
Specs2Specs2
Specs2
 
SystemT: Declarative Information Extraction
SystemT: Declarative Information ExtractionSystemT: Declarative Information Extraction
SystemT: Declarative Information Extraction
 
Object relationship mapping and hibernate
Object relationship mapping and hibernateObject relationship mapping and hibernate
Object relationship mapping and hibernate
 
Wipro technical interview questions
Wipro technical interview questionsWipro technical interview questions
Wipro technical interview questions
 
Er Modeling
Er ModelingEr Modeling
Er Modeling
 

Destacado

3 extreme performance - databases acceleration using ssd
3   extreme performance - databases acceleration using ssd 3   extreme performance - databases acceleration using ssd
3 extreme performance - databases acceleration using ssd sqlserver.co.il
 
Products.intro.forum version
Products.intro.forum versionProducts.intro.forum version
Products.intro.forum versionsqlserver.co.il
 
SQL Explore 2012: P&T Part 3
SQL Explore 2012: P&T Part 3SQL Explore 2012: P&T Part 3
SQL Explore 2012: P&T Part 3sqlserver.co.il
 
Adi Sapir ISUG 123 11/10/2012
Adi Sapir ISUG 123 11/10/2012Adi Sapir ISUG 123 11/10/2012
Adi Sapir ISUG 123 11/10/2012sqlserver.co.il
 
Query handlingbytheserver
Query handlingbytheserverQuery handlingbytheserver
Query handlingbytheserversqlserver.co.il
 
Sql server user group news january 2013
Sql server user group news   january 2013Sql server user group news   january 2013
Sql server user group news january 2013sqlserver.co.il
 
Things you can find in the plan cache
Things you can find in the plan cacheThings you can find in the plan cache
Things you can find in the plan cachesqlserver.co.il
 
Windows azure sql_database_security_isug012013
Windows azure sql_database_security_isug012013Windows azure sql_database_security_isug012013
Windows azure sql_database_security_isug012013sqlserver.co.il
 

Destacado (9)

3 extreme performance - databases acceleration using ssd
3   extreme performance - databases acceleration using ssd 3   extreme performance - databases acceleration using ssd
3 extreme performance - databases acceleration using ssd
 
Products.intro.forum version
Products.intro.forum versionProducts.intro.forum version
Products.intro.forum version
 
SQL Explore 2012: P&T Part 3
SQL Explore 2012: P&T Part 3SQL Explore 2012: P&T Part 3
SQL Explore 2012: P&T Part 3
 
DAC 2012
DAC 2012DAC 2012
DAC 2012
 
Adi Sapir ISUG 123 11/10/2012
Adi Sapir ISUG 123 11/10/2012Adi Sapir ISUG 123 11/10/2012
Adi Sapir ISUG 123 11/10/2012
 
Query handlingbytheserver
Query handlingbytheserverQuery handlingbytheserver
Query handlingbytheserver
 
Sql server user group news january 2013
Sql server user group news   january 2013Sql server user group news   january 2013
Sql server user group news january 2013
 
Things you can find in the plan cache
Things you can find in the plan cacheThings you can find in the plan cache
Things you can find in the plan cache
 
Windows azure sql_database_security_isug012013
Windows azure sql_database_security_isug012013Windows azure sql_database_security_isug012013
Windows azure sql_database_security_isug012013
 

Similar a 3 where are my keys - sql explore

Most frequently asked infosys technical interview questions and answers in 2018
Most frequently asked infosys technical interview questions and answers in 2018Most frequently asked infosys technical interview questions and answers in 2018
Most frequently asked infosys technical interview questions and answers in 2018nishajj
 
Avoiding common database pitfalls
Avoiding common database pitfallsAvoiding common database pitfalls
Avoiding common database pitfallsDerek Binkley
 
NLIDB(Natural Language Interface to DataBases)
NLIDB(Natural Language Interface to DataBases)NLIDB(Natural Language Interface to DataBases)
NLIDB(Natural Language Interface to DataBases)Swetha Pallati
 
Domain oriented development
Domain oriented developmentDomain oriented development
Domain oriented developmentrajmundr
 
Dare to build vertical design with relational data (Entity-Attribute-Value)
Dare to build vertical design with relational data (Entity-Attribute-Value)Dare to build vertical design with relational data (Entity-Attribute-Value)
Dare to build vertical design with relational data (Entity-Attribute-Value)Ivo Andreev
 
Prague data management meetup 2016-11-22
Prague data management meetup 2016-11-22Prague data management meetup 2016-11-22
Prague data management meetup 2016-11-22Martin Bém
 
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim RemaniFinding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim RemaniJAXLondon2014
 
01 Persistence And Orm
01 Persistence And Orm01 Persistence And Orm
01 Persistence And OrmRanjan Kumar
 
Mc0077 – advanced database systems
Mc0077 – advanced database systemsMc0077 – advanced database systems
Mc0077 – advanced database systemsRabby Bhatt
 
Cts informatica interview question answers
Cts informatica interview question answersCts informatica interview question answers
Cts informatica interview question answersSweta Singh
 
Intelligent query converter a domain independent interfacefor conversion
Intelligent query converter a domain independent interfacefor conversionIntelligent query converter a domain independent interfacefor conversion
Intelligent query converter a domain independent interfacefor conversionIAEME Publication
 
The Importance of Data Analysis in Producing a Robust Physical Data Model
The Importance of Data Analysis in Producing a Robust Physical Data ModelThe Importance of Data Analysis in Producing a Robust Physical Data Model
The Importance of Data Analysis in Producing a Robust Physical Data ModelDeclan Chellar
 
2006 DDD4: Data access layers - Convenience vs. Control and Performance?
2006 DDD4: Data access layers - Convenience vs. Control and Performance?2006 DDD4: Data access layers - Convenience vs. Control and Performance?
2006 DDD4: Data access layers - Convenience vs. Control and Performance?Daniel Fisher
 
Elegant and Efficient Database Design
Elegant and Efficient Database DesignElegant and Efficient Database Design
Elegant and Efficient Database DesignBecky Sweger
 
Why you shouldnt use django for that
Why you shouldnt use django for thatWhy you shouldnt use django for that
Why you shouldnt use django for thatIván Stepaniuk
 
2. Relational_Data_Model_Keys_10b.pptx
2. Relational_Data_Model_Keys_10b.pptx2. Relational_Data_Model_Keys_10b.pptx
2. Relational_Data_Model_Keys_10b.pptxvidyahulkman
 
Lecture 13
Lecture 13Lecture 13
Lecture 13Shani729
 
The Joy Of Functional Programming
The Joy Of Functional ProgrammingThe Joy Of Functional Programming
The Joy Of Functional Programmingjasondew
 
Performance By Design
Performance By DesignPerformance By Design
Performance By DesignGuy Harrison
 

Similar a 3 where are my keys - sql explore (20)

Most frequently asked infosys technical interview questions and answers in 2018
Most frequently asked infosys technical interview questions and answers in 2018Most frequently asked infosys technical interview questions and answers in 2018
Most frequently asked infosys technical interview questions and answers in 2018
 
Avoiding common database pitfalls
Avoiding common database pitfallsAvoiding common database pitfalls
Avoiding common database pitfalls
 
Rdbms
RdbmsRdbms
Rdbms
 
NLIDB(Natural Language Interface to DataBases)
NLIDB(Natural Language Interface to DataBases)NLIDB(Natural Language Interface to DataBases)
NLIDB(Natural Language Interface to DataBases)
 
Domain oriented development
Domain oriented developmentDomain oriented development
Domain oriented development
 
Dare to build vertical design with relational data (Entity-Attribute-Value)
Dare to build vertical design with relational data (Entity-Attribute-Value)Dare to build vertical design with relational data (Entity-Attribute-Value)
Dare to build vertical design with relational data (Entity-Attribute-Value)
 
Prague data management meetup 2016-11-22
Prague data management meetup 2016-11-22Prague data management meetup 2016-11-22
Prague data management meetup 2016-11-22
 
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim RemaniFinding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
Finding your Way in the Midst of the NoSQL Haze - Abdelmonaim Remani
 
01 Persistence And Orm
01 Persistence And Orm01 Persistence And Orm
01 Persistence And Orm
 
Mc0077 – advanced database systems
Mc0077 – advanced database systemsMc0077 – advanced database systems
Mc0077 – advanced database systems
 
Cts informatica interview question answers
Cts informatica interview question answersCts informatica interview question answers
Cts informatica interview question answers
 
Intelligent query converter a domain independent interfacefor conversion
Intelligent query converter a domain independent interfacefor conversionIntelligent query converter a domain independent interfacefor conversion
Intelligent query converter a domain independent interfacefor conversion
 
The Importance of Data Analysis in Producing a Robust Physical Data Model
The Importance of Data Analysis in Producing a Robust Physical Data ModelThe Importance of Data Analysis in Producing a Robust Physical Data Model
The Importance of Data Analysis in Producing a Robust Physical Data Model
 
2006 DDD4: Data access layers - Convenience vs. Control and Performance?
2006 DDD4: Data access layers - Convenience vs. Control and Performance?2006 DDD4: Data access layers - Convenience vs. Control and Performance?
2006 DDD4: Data access layers - Convenience vs. Control and Performance?
 
Elegant and Efficient Database Design
Elegant and Efficient Database DesignElegant and Efficient Database Design
Elegant and Efficient Database Design
 
Why you shouldnt use django for that
Why you shouldnt use django for thatWhy you shouldnt use django for that
Why you shouldnt use django for that
 
2. Relational_Data_Model_Keys_10b.pptx
2. Relational_Data_Model_Keys_10b.pptx2. Relational_Data_Model_Keys_10b.pptx
2. Relational_Data_Model_Keys_10b.pptx
 
Lecture 13
Lecture 13Lecture 13
Lecture 13
 
The Joy Of Functional Programming
The Joy Of Functional ProgrammingThe Joy Of Functional Programming
The Joy Of Functional Programming
 
Performance By Design
Performance By DesignPerformance By Design
Performance By Design
 

Más de sqlserver.co.il

SQL Explore 2012: P&T Part 2
SQL Explore 2012: P&T Part 2SQL Explore 2012: P&T Part 2
SQL Explore 2012: P&T Part 2sqlserver.co.il
 
SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1sqlserver.co.il
 
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended EventsSQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Eventssqlserver.co.il
 
SQL Explore 2012 - Michael Zilberstein: ColumnStore
SQL Explore 2012 - Michael Zilberstein: ColumnStoreSQL Explore 2012 - Michael Zilberstein: ColumnStore
SQL Explore 2012 - Michael Zilberstein: ColumnStoresqlserver.co.il
 
SQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DACSQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DACsqlserver.co.il
 
SQL Explore 2012 - Aviad Deri: Spatial
SQL Explore 2012 - Aviad Deri: SpatialSQL Explore 2012 - Aviad Deri: Spatial
SQL Explore 2012 - Aviad Deri: Spatialsqlserver.co.il
 
Bi303 data warehousing with fast track and pdw - Assaf Fraenkel
Bi303 data warehousing with fast track and pdw - Assaf FraenkelBi303 data warehousing with fast track and pdw - Assaf Fraenkel
Bi303 data warehousing with fast track and pdw - Assaf Fraenkelsqlserver.co.il
 
Fast transition to sql server 2012 from mssql 2005 2008 for developers - Dav...
Fast transition to sql server 2012 from mssql 2005 2008 for  developers - Dav...Fast transition to sql server 2012 from mssql 2005 2008 for  developers - Dav...
Fast transition to sql server 2012 from mssql 2005 2008 for developers - Dav...sqlserver.co.il
 
Extreme performance - IDF UG
Extreme performance - IDF UGExtreme performance - IDF UG
Extreme performance - IDF UGsqlserver.co.il
 
3 extreme performance - databases acceleration using ssd
3   extreme performance - databases acceleration using ssd 3   extreme performance - databases acceleration using ssd
3 extreme performance - databases acceleration using ssd sqlserver.co.il
 
4 extreme performance - part ii
4   extreme performance - part ii4   extreme performance - part ii
4 extreme performance - part iisqlserver.co.il
 
2 extreme performance - smaller is better
2   extreme performance - smaller is better2   extreme performance - smaller is better
2 extreme performance - smaller is bettersqlserver.co.il
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part isqlserver.co.il
 
6 sql explorer - powershell dba
6   sql explorer - powershell dba6   sql explorer - powershell dba
6 sql explorer - powershell dbasqlserver.co.il
 

Más de sqlserver.co.il (20)

SQL Explore 2012: P&T Part 2
SQL Explore 2012: P&T Part 2SQL Explore 2012: P&T Part 2
SQL Explore 2012: P&T Part 2
 
SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1SQL Explore 2012: P&T Part 1
SQL Explore 2012: P&T Part 1
 
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended EventsSQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
SQL Explore 2012 - Tzahi Hakikat and Keren Bartal: Extended Events
 
SQL Explore 2012 - Michael Zilberstein: ColumnStore
SQL Explore 2012 - Michael Zilberstein: ColumnStoreSQL Explore 2012 - Michael Zilberstein: ColumnStore
SQL Explore 2012 - Michael Zilberstein: ColumnStore
 
SQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DACSQL Explore 2012 - Meir Dudai: DAC
SQL Explore 2012 - Meir Dudai: DAC
 
SQL Explore 2012 - Aviad Deri: Spatial
SQL Explore 2012 - Aviad Deri: SpatialSQL Explore 2012 - Aviad Deri: Spatial
SQL Explore 2012 - Aviad Deri: Spatial
 
מיכאל
מיכאלמיכאל
מיכאל
 
נועם
נועםנועם
נועם
 
עדי
עדיעדי
עדי
 
מיכאל
מיכאלמיכאל
מיכאל
 
Bi303 data warehousing with fast track and pdw - Assaf Fraenkel
Bi303 data warehousing with fast track and pdw - Assaf FraenkelBi303 data warehousing with fast track and pdw - Assaf Fraenkel
Bi303 data warehousing with fast track and pdw - Assaf Fraenkel
 
DBCC - Dubi Lebel
DBCC - Dubi LebelDBCC - Dubi Lebel
DBCC - Dubi Lebel
 
Fast transition to sql server 2012 from mssql 2005 2008 for developers - Dav...
Fast transition to sql server 2012 from mssql 2005 2008 for  developers - Dav...Fast transition to sql server 2012 from mssql 2005 2008 for  developers - Dav...
Fast transition to sql server 2012 from mssql 2005 2008 for developers - Dav...
 
ISUG 113: File stream
ISUG 113: File streamISUG 113: File stream
ISUG 113: File stream
 
Extreme performance - IDF UG
Extreme performance - IDF UGExtreme performance - IDF UG
Extreme performance - IDF UG
 
3 extreme performance - databases acceleration using ssd
3   extreme performance - databases acceleration using ssd 3   extreme performance - databases acceleration using ssd
3 extreme performance - databases acceleration using ssd
 
4 extreme performance - part ii
4   extreme performance - part ii4   extreme performance - part ii
4 extreme performance - part ii
 
2 extreme performance - smaller is better
2   extreme performance - smaller is better2   extreme performance - smaller is better
2 extreme performance - smaller is better
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part i
 
6 sql explorer - powershell dba
6   sql explorer - powershell dba6   sql explorer - powershell dba
6 sql explorer - powershell dba
 

Último

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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
 
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
 
[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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
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
 
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
 

Último (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
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
 
[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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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
 
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
 

3 where are my keys - sql explore

  • 1. Where Are My Keys? Ami Levin | CTO | DBSophic LTD
  • 2. Session Goals A revisit to some of the fundamental design principals of relational databases: Normalization rules, key selection, and the controversies associated with these issues from a very practical, hands-on perspective, with special emphasis on some surprising performance issues that may arise from sub-optimal selection of keys...
  • 4. Normalization “A relation whose domains are all simple can be represented in storage by a two-dimensional column homogeneous array of the kind discussed above. Some more complicated data structure is necessary for a relation with one or more non-simple domains. For this reason (and others to be cited below) the possibility of eliminating non-simple domains appears worth investigating. There is, in fact, a very simple elimination procedure, which we shall call… normalization”
  • 5. 1st Normal Form There's no top-to-bottom or left-to-right ordering to the rows and columns There are no duplicate rows Every row-column intersection contains exactly one value All columns are regular
  • 7. 2nd Normal Form R is in 1st Normal Form (1NF). Given any candidate key K and any attribute A that is not a constituent of a candidate key, A depends upon the whole of K rather than just a part of it.
  • 9. 3rd Normal Form R is in second normal form (2NF) Every non-prime attribute of R is non-transitively dependent on every candidate key of R. A transitive dependency is a functional dependency, in which X -> Z (X determines Z) indirectly, by virtue of X -> Y and Y -> Z.
  • 11. Keys Simple Composite Candidate Primary Artificial / Surrogate Intelligent Natural
  • 12. The Debate To ID or not to ID? IDENTITY (1,1) PK vs. Natural key
  • 13. Pro Artificial In some cases, no natural key exists and an artificial key is the only option. Examples?
  • 14. Pro Artificial Natural keys can change. Artificial keys never change. How Often? Cascading referential constraints Artificial keys can change
  • 15. Pro Artificial Natural keys may become very long and complex. Get longer with each level 900 Bytes limit in SQL Server Multi-column Joins
  • 16. Pro Artificial Artificial keys improve performance. Simpler join predicates Ever increasing clustering effect Short keys = Smaller DB = Faster (?)
  • 17. Pro Artificial Artificial keys reduce clustered index fragmentation. All types of artificial keys? Minimize maintenance down time What about deletes? What about non-clustered indexes?
  • 18. Pro Natural Natural keys have business meaning. Artificial keys are logically never queried for
  • 19. Pro Natural Queries on tables using natural keys require fewer joins. The more familiar and meaningful the key, the less joins are required “Bypass” joins across levels
  • 20. Pro Natural Data consistency is maintained explicitly when using natural keys. Artificial keys enable logical duplicates
  • 21. Pro Natural Natural keys eliminate potential physical clustering performance issues. Contention for clustered regions
  • 22. Less Mentioned Issues Artificial keys are the de-facto standard. ORM generate artificial keys LINQ doesn’t cache composite key rows
  • 23. Less Mentioned Issues Data statistics and optimizations. Statistics on artificial keys are useless for parameter sniffing Selectivity estimations on composite key statistics are less accurate
  • 24. Less Mentioned Issues Modularity and portability. Migration to other platforms Merging with other databases
  • 25. Less Mentioned Issues Simplicity and aesthetics.
  • 26. Demo Design Spec URL Country and city of owner Country ISO code needed by application Data consistency is crucial
  • 28. Ask Yourself… Is there a natural key that I can use as PK? Are there a few natural candidates? Which one is the simplest and most familiar? How stable is it? How will it be used logically? What will be the table physical usage patterns? What are the common query types for this table?
  • 29. For More Information A Relational Model of Data for Large Shared Data Banksby E. F. CODD. The Relational Model for Database Management: Version 2 by E.F. Codd. An introduction to database systemsby C.J Date. Database in Depth: Relational Theory for Practitionersby C.J Date. The Database Relational Model: A Retrospective Review and Analysisby C.J Date. Joe Celko's Data and Databases: Concepts in Practice by Joe Celko. Joe Celko's SQL for Smarties, Fourth Edition: Advanced SQL Programmingby Joe Celko. Database Modeling and Design, Fifth Edition: Logical Designby Toby J. Teorey, Sam S. Lightstone, Tom Nadeau, and H.V. Jagadish. Pro SQL Server 2008 Relational Database Design and Implementationby Louis Davidson, Kevin Kline, Scott Klein, and Kurt Windisch.
  • 30. Where Are My Keys? Q&A