SlideShare a Scribd company logo
1 of 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

More Related Content

Similar to 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 to 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
 

More from 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
 

More from 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
 

Recently uploaded

Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 

Recently uploaded (20)

Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 

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