SlideShare una empresa de Scribd logo
1 de 106
Why normalize database?
 Remove data redundancy…
 …and use less storage
 More extensibility without changing existing schema
 Easier to deploy database changes without downtime
 Backwards compatibility!
 Tables are smaller and more readable
 More data integrity and consistency
We don’t normalize databases because…
 It’s to much work / I don’t have time for this
 “I’m not DBA”
 I’ll need shitload of JOINs, querying is harder and queries are more difficult to
read
 Storage is cheap
 It’s harder to maintain performance
Person Entity
 Id
 Name
 Last name
Person Entity
 Id - unique
 Name – can repeat itself
 Last name – can repeat itself
Person Entity
 Id
 Name – separate lookup table
 Last name – separate lookup table
View or function 'dbo.Vw_Person' is not updatable because the modification affects
multiple base tables.
Anchor Modeling
maintain highly normalized data model that
can be changed anytime
Rafał Hryniewski
@r_hryniewski
fb.me/hryniewskinet
Senior .NET Dev
Blogger
Speaker
Community leader
https://hryniewski.net
rafal@hryniewski.net
Agenda
 Evolving highly normalized schema in traditional way.
 Glossary.
 How does it look?
 Anchors, ties and other modeling constructs.
 Features
Glossary
 Normalization – structuring relational database to minimize data redundancy and
improve data integrity
 Temporal Data – data with relation to time in terms of validity time, transaction
time and/or decision time
Anchor Modeling is
 Database modeling technique
 Agile
 Can work with temporal data
 Easy
 Has graphic UI modeling tool
 Uses four modeling contructs: anchors, attributes, ties and knots
Databases created with Anchor Modeling are
 Mostly in 6th normal form
 Easy to expand
 Temporal (if you want it to be)
 Ready to work with in no time
 Can be deployed with zero downtime
Requirements
 3 entities – Person, Company, Post
 Person should have Name, Last Name and Date of Birth
 Company should have Name
 Post should have Title, Content and Creation Date
Requirements
 3 entities – Person, Company, Post
 Person should be able to be friend with other Person
 Person should be able to be employed in Company
 Person and Company are able to create Posts
Anchor
 Represents business entity
Attribute
 Is property of an anchor
 Mnemonic must be unique in scope of an anchor
 Can be knotted
Knot
 Used when attribute is repetitive for many entities ie. Category
 Has it’s own identity key (ie. CategoryId)
 Think of it as dictionary table
 Linked with anchor through attribute
Tie
 Models relationships between anchors
 Has roles (ie. “knows”, “is owned by”)
How many lines was required to build
above sample model?
 4047
Anchor
Anchor
Attribute
Attribute
Knot
Knot
Tie
Tie
Temporal data
 Any data can be historized
 You can record changes at specified point of time (ie. Price year ago)
Change request
• Post Title should be versioned
• Post Content should be versioned
Temporal perspectives
Based on views/functions with prefixes:
 n / Current –now
 l / Latest – latest (can include future data)
 p / Point – data in specified point in time
 d / Difference – data changes in two points in time
Evolving your schema
 Highly iterative (Modifying already deployed tables can cause errors)
 Does not touch existing data
 Previous schema is always subset of new one
 Deployments can be made without any downtime
 It’s easy to maintain backwards compatibility within an app
Table elimination
 It’s possible because of higly normalization and relational structure
 In short “if you don’t need it – don’t touch it”
 Requires explicit select statements
Cons
 Using it in your apps will require some skill
 It’s niche
 Not everything works in Azure SQL
 Modifications by hand are not easy
Resources
 www.anchormodeling.com
Slides
 bit.ly/rh-anchor
Questions?
@r_hryniewskifb.me/hryniewskinet
Try it – at home

Más contenido relacionado

Similar a Anchor modeling

No more Three Tier - A path to a better code for Cloud and Azure
No more Three Tier - A path to a better code for Cloud and AzureNo more Three Tier - A path to a better code for Cloud and Azure
No more Three Tier - A path to a better code for Cloud and AzureMarco Parenzan
 
Map Reduce amrp presentation
Map Reduce amrp presentationMap Reduce amrp presentation
Map Reduce amrp presentationrenjan131
 
Arches Getty Brownbag Talk
Arches Getty Brownbag TalkArches Getty Brownbag Talk
Arches Getty Brownbag Talkbenosteen
 
Datalayer Best Practices with Observepoint
Datalayer Best Practices with ObservepointDatalayer Best Practices with Observepoint
Datalayer Best Practices with ObservepointMike Plant
 
How the BBC Make Web sites
How the BBC Make Web sitesHow the BBC Make Web sites
How the BBC Make Web sitesIWMW
 
Master Meta Data
Master Meta DataMaster Meta Data
Master Meta DataDigikrit
 
What is struts_en
What is struts_enWhat is struts_en
What is struts_entechbed
 
Alfresco Tech Talk Live #92 - Model Management
Alfresco Tech Talk Live #92 - Model ManagementAlfresco Tech Talk Live #92 - Model Management
Alfresco Tech Talk Live #92 - Model ManagementMike Farman
 
Open Conceptual Data Models
Open Conceptual Data ModelsOpen Conceptual Data Models
Open Conceptual Data Modelsrumito
 
Data Wrangling and Visualization Using Python
Data Wrangling and Visualization Using PythonData Wrangling and Visualization Using Python
Data Wrangling and Visualization Using PythonMOHITKUMAR1379
 
Data Lakehouse, Data Mesh, and Data Fabric (r2)
Data Lakehouse, Data Mesh, and Data Fabric (r2)Data Lakehouse, Data Mesh, and Data Fabric (r2)
Data Lakehouse, Data Mesh, and Data Fabric (r2)James Serra
 
What Is Super Key In Dbms
What Is Super Key In DbmsWhat Is Super Key In Dbms
What Is Super Key In DbmsTheresa Singh
 
Domain oriented development
Domain oriented developmentDomain oriented development
Domain oriented developmentrajmundr
 

Similar a Anchor modeling (20)

No more Three Tier - A path to a better code for Cloud and Azure
No more Three Tier - A path to a better code for Cloud and AzureNo more Three Tier - A path to a better code for Cloud and Azure
No more Three Tier - A path to a better code for Cloud and Azure
 
Map Reduce amrp presentation
Map Reduce amrp presentationMap Reduce amrp presentation
Map Reduce amrp presentation
 
Arches Getty Brownbag Talk
Arches Getty Brownbag TalkArches Getty Brownbag Talk
Arches Getty Brownbag Talk
 
Presentation1
Presentation1Presentation1
Presentation1
 
Datalayer Best Practices with Observepoint
Datalayer Best Practices with ObservepointDatalayer Best Practices with Observepoint
Datalayer Best Practices with Observepoint
 
How the BBC Make Web sites
How the BBC Make Web sitesHow the BBC Make Web sites
How the BBC Make Web sites
 
Hibernate
HibernateHibernate
Hibernate
 
Master Meta Data
Master Meta DataMaster Meta Data
Master Meta Data
 
What is struts_en
What is struts_enWhat is struts_en
What is struts_en
 
Alfresco Tech Talk Live #92 - Model Management
Alfresco Tech Talk Live #92 - Model ManagementAlfresco Tech Talk Live #92 - Model Management
Alfresco Tech Talk Live #92 - Model Management
 
Open Conceptual Data Models
Open Conceptual Data ModelsOpen Conceptual Data Models
Open Conceptual Data Models
 
Nosql
NosqlNosql
Nosql
 
Nosql
NosqlNosql
Nosql
 
Database system
Database system Database system
Database system
 
ch02models.pptx
ch02models.pptxch02models.pptx
ch02models.pptx
 
ch02models.pptx
ch02models.pptxch02models.pptx
ch02models.pptx
 
Data Wrangling and Visualization Using Python
Data Wrangling and Visualization Using PythonData Wrangling and Visualization Using Python
Data Wrangling and Visualization Using Python
 
Data Lakehouse, Data Mesh, and Data Fabric (r2)
Data Lakehouse, Data Mesh, and Data Fabric (r2)Data Lakehouse, Data Mesh, and Data Fabric (r2)
Data Lakehouse, Data Mesh, and Data Fabric (r2)
 
What Is Super Key In Dbms
What Is Super Key In DbmsWhat Is Super Key In Dbms
What Is Super Key In Dbms
 
Domain oriented development
Domain oriented developmentDomain oriented development
Domain oriented development
 

Más de Rafał Hryniewski

DevSecOps - security all the way
DevSecOps - security all the wayDevSecOps - security all the way
DevSecOps - security all the wayRafał Hryniewski
 
DevSecOps - Security all the way
DevSecOps - Security all the wayDevSecOps - Security all the way
DevSecOps - Security all the wayRafał Hryniewski
 
Large scale, distributed and reliable messaging with Kafka
Large scale, distributed and reliable messaging with KafkaLarge scale, distributed and reliable messaging with Kafka
Large scale, distributed and reliable messaging with KafkaRafał Hryniewski
 
Meet Gremlin – your guide through graphs in Cosmos DB
Meet Gremlin – your guide through graphs in Cosmos DBMeet Gremlin – your guide through graphs in Cosmos DB
Meet Gremlin – your guide through graphs in Cosmos DBRafał Hryniewski
 
Shit happens – achieve extensibility, modularity and loosely coupled architec...
Shit happens – achieve extensibility, modularity and loosely coupled architec...Shit happens – achieve extensibility, modularity and loosely coupled architec...
Shit happens – achieve extensibility, modularity and loosely coupled architec...Rafał Hryniewski
 
Public speaking - why am I doing this to myself and why you should too?
Public speaking - why am I doing this to myself and why you should too?Public speaking - why am I doing this to myself and why you should too?
Public speaking - why am I doing this to myself and why you should too?Rafał Hryniewski
 
Azure SQL - more or/and less than SQL Server
Azure SQL - more or/and less than SQL ServerAzure SQL - more or/and less than SQL Server
Azure SQL - more or/and less than SQL ServerRafał Hryniewski
 
Essential security measures in ASP.NET MVC
Essential security measures in ASP.NET MVC Essential security measures in ASP.NET MVC
Essential security measures in ASP.NET MVC Rafał Hryniewski
 
ORM – The tip of an iceberg
ORM – The tip of an icebergORM – The tip of an iceberg
ORM – The tip of an icebergRafał Hryniewski
 
Quick trip around the Cosmos - Things every astronaut supposed to know
Quick trip around the Cosmos - Things every astronaut supposed to knowQuick trip around the Cosmos - Things every astronaut supposed to know
Quick trip around the Cosmos - Things every astronaut supposed to knowRafał Hryniewski
 

Más de Rafał Hryniewski (17)

Azure messaging
Azure messagingAzure messaging
Azure messaging
 
Azure developer
Azure developerAzure developer
Azure developer
 
Great webapis
Great webapisGreat webapis
Great webapis
 
DevSecOps - security all the way
DevSecOps - security all the wayDevSecOps - security all the way
DevSecOps - security all the way
 
DevSecOps - Security all the way
DevSecOps - Security all the wayDevSecOps - Security all the way
DevSecOps - Security all the way
 
Large scale, distributed and reliable messaging with Kafka
Large scale, distributed and reliable messaging with KafkaLarge scale, distributed and reliable messaging with Kafka
Large scale, distributed and reliable messaging with Kafka
 
Meet Gremlin – your guide through graphs in Cosmos DB
Meet Gremlin – your guide through graphs in Cosmos DBMeet Gremlin – your guide through graphs in Cosmos DB
Meet Gremlin – your guide through graphs in Cosmos DB
 
Shit happens – achieve extensibility, modularity and loosely coupled architec...
Shit happens – achieve extensibility, modularity and loosely coupled architec...Shit happens – achieve extensibility, modularity and loosely coupled architec...
Shit happens – achieve extensibility, modularity and loosely coupled architec...
 
Web app security essentials
Web app security essentialsWeb app security essentials
Web app security essentials
 
Public speaking - why am I doing this to myself and why you should too?
Public speaking - why am I doing this to myself and why you should too?Public speaking - why am I doing this to myself and why you should too?
Public speaking - why am I doing this to myself and why you should too?
 
Azure SQL - more or/and less than SQL Server
Azure SQL - more or/and less than SQL ServerAzure SQL - more or/and less than SQL Server
Azure SQL - more or/and less than SQL Server
 
Blazor
BlazorBlazor
Blazor
 
Shodan
ShodanShodan
Shodan
 
Essential security measures in ASP.NET MVC
Essential security measures in ASP.NET MVC Essential security measures in ASP.NET MVC
Essential security measures in ASP.NET MVC
 
.NET, Alexa and me
.NET, Alexa and me.NET, Alexa and me
.NET, Alexa and me
 
ORM – The tip of an iceberg
ORM – The tip of an icebergORM – The tip of an iceberg
ORM – The tip of an iceberg
 
Quick trip around the Cosmos - Things every astronaut supposed to know
Quick trip around the Cosmos - Things every astronaut supposed to knowQuick trip around the Cosmos - Things every astronaut supposed to know
Quick trip around the Cosmos - Things every astronaut supposed to know
 

Último

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 

Último (20)

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 

Anchor modeling

  • 1.
  • 2.
  • 3. Why normalize database?  Remove data redundancy…  …and use less storage  More extensibility without changing existing schema  Easier to deploy database changes without downtime  Backwards compatibility!  Tables are smaller and more readable  More data integrity and consistency
  • 4.
  • 5.
  • 6.
  • 7. We don’t normalize databases because…  It’s to much work / I don’t have time for this  “I’m not DBA”  I’ll need shitload of JOINs, querying is harder and queries are more difficult to read  Storage is cheap  It’s harder to maintain performance
  • 8.
  • 9.
  • 10.
  • 11. Person Entity  Id  Name  Last name
  • 12. Person Entity  Id - unique  Name – can repeat itself  Last name – can repeat itself
  • 13. Person Entity  Id  Name – separate lookup table  Last name – separate lookup table
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25. View or function 'dbo.Vw_Person' is not updatable because the modification affects multiple base tables.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36. Anchor Modeling maintain highly normalized data model that can be changed anytime
  • 37. Rafał Hryniewski @r_hryniewski fb.me/hryniewskinet Senior .NET Dev Blogger Speaker Community leader https://hryniewski.net rafal@hryniewski.net
  • 38.
  • 39. Agenda  Evolving highly normalized schema in traditional way.  Glossary.  How does it look?  Anchors, ties and other modeling constructs.  Features
  • 40. Glossary  Normalization – structuring relational database to minimize data redundancy and improve data integrity  Temporal Data – data with relation to time in terms of validity time, transaction time and/or decision time
  • 41.
  • 42. Anchor Modeling is  Database modeling technique  Agile  Can work with temporal data  Easy  Has graphic UI modeling tool  Uses four modeling contructs: anchors, attributes, ties and knots
  • 43. Databases created with Anchor Modeling are  Mostly in 6th normal form  Easy to expand  Temporal (if you want it to be)  Ready to work with in no time  Can be deployed with zero downtime
  • 44.
  • 45. Requirements  3 entities – Person, Company, Post  Person should have Name, Last Name and Date of Birth  Company should have Name  Post should have Title, Content and Creation Date
  • 46. Requirements  3 entities – Person, Company, Post  Person should be able to be friend with other Person  Person should be able to be employed in Company  Person and Company are able to create Posts
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 57.
  • 58. Attribute  Is property of an anchor  Mnemonic must be unique in scope of an anchor  Can be knotted
  • 59.
  • 60. Knot  Used when attribute is repetitive for many entities ie. Category  Has it’s own identity key (ie. CategoryId)  Think of it as dictionary table  Linked with anchor through attribute
  • 61.
  • 62. Tie  Models relationships between anchors  Has roles (ie. “knows”, “is owned by”)
  • 63.
  • 64.
  • 65.
  • 66. How many lines was required to build above sample model?  4047
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 77. Knot
  • 78. Knot
  • 79. Tie
  • 80. Tie
  • 81.
  • 82. Temporal data  Any data can be historized  You can record changes at specified point of time (ie. Price year ago)
  • 83.
  • 84. Change request • Post Title should be versioned • Post Content should be versioned
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90. Temporal perspectives Based on views/functions with prefixes:  n / Current –now  l / Latest – latest (can include future data)  p / Point – data in specified point in time  d / Difference – data changes in two points in time
  • 91.
  • 92.
  • 93.
  • 94. Evolving your schema  Highly iterative (Modifying already deployed tables can cause errors)  Does not touch existing data  Previous schema is always subset of new one  Deployments can be made without any downtime  It’s easy to maintain backwards compatibility within an app
  • 95.
  • 96. Table elimination  It’s possible because of higly normalization and relational structure  In short “if you don’t need it – don’t touch it”  Requires explicit select statements
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102. Cons  Using it in your apps will require some skill  It’s niche  Not everything works in Azure SQL  Modifications by hand are not easy