NOSQL DATABASE SYSTEMS: DATA MODELING Big Data Technologies: NoSQL DBMS (Data Modeling) - SoSe 2017 24
Data Modeling Object-relational impedance mismatch Example: orders, order lines, customers (with different payment methods) Object-oriented modeling Mapping to relational database Big Data Technologies: NoSQL DBMS (Data Modeling) - SoSe 2017 25
Data Modeling Decisions Primary Decision: Embedding vs. Referencing However, to consider There are no (or very limited) join operations within NoSQL database systems! There are no distributed transactions within NoSQL! Advantages and Disadvantages of Embedding Advantages and Disadvantages of Referencing Martin Fowler: Aggregate-Oriented Modeling Big Data Technologies: NoSQL DBMS (Data Modeling) - SoSe 2017 26
Data Modeling: Document Store DBS How to realize references? Direction of references? Embedding: What about denormalization and redundancy? Big Data Technologies: NoSQL DBMS (Data Modeling) - SoSe 2017 27
Data Modeling: Document Store DBS Excurse: Join operations There are no (or very limited) join operations within NoSQL database systems New in MongoDB (since release 3.2) $lookup operator which implements left-outer equi-joins to an unsharded collection in the same database New in Couchbase (since release 4.0 introduction of N1QL) JOIN operator for left-outer or inner equi joins on document id (right side) Performance? (see Exercise 2) How to realize joins without join operators? Big Data Technologies: NoSQL DBMS (Data Modeling) - SoSe 2017 28
Data Modeling: Column Family DBS How to implement embedded objects in column family database systems? Variant 1: Using run-time named column qualifiers Variant 2: Using timestamps (or other id s) New (since Cassandra CQL3): Using collection types (map, set, list) What about column families? Big Data Technologies: NoSQL DBMS (Data Modeling) - SoSe 2017 29
Data Modeling: Key-Value Database Systems What about data modeling in key-value database systems? Big Data Technologies: NoSQL DBMS (Data Modeling) - SoSe 2017 30
Aggregate-oriented Data Modeling Aggregate-oriented data models / aggregate-oriented database systems (i.e., key-value, document store and column family database systems) Have a fundamental unit of storage which is a rich structure of closely related data Make it easier for the database to manage data storage over clusters, since the unit of data now could reside on any machine Work best when most data interaction is done with the same aggregate Make inter-aggregate relationships more difficult to handle than intra-aggregate relationships In contrast, graph databases Focus on relationships (related items) Item relationships are natively supported by graph databases and optimized for fast navigation. Further reading: https://www.thoughtworks.com/insights/blog/nosql-databases-overview and Sadalage, P. J., Fowler, M. NoSQL Distilled: A Brief Guide to the Emerging World of Polyglot Persistence Big Data Technologies: NoSQL DBMS (Data Modeling) - SoSe 2017 31
Data Modeling: Graph Databases Easy to design and model direct representation of the model Whiteboard Friendlyness Source: Neo Technology, Inc. Big Data Technologies: NoSQL DBMS (Data Modeling) - SoSe 2017 32
Data Modeling: Graph Databases Source: Neo Technology, Inc. Big Data Technologies: NoSQL DBMS (Data Modeling) - SoSe 2017 33
Data Modeling: Graph Databases Best Practices Nodes for Things Relationships for Structure Represent complex value types as nodes Iterative and incremental development Test-driven data model development Big Data Technologies: NoSQL DBMS (Data Modeling) - SoSe 2017 34
Data Modeling: Conclusion Aggregate-oriented vs. relational or graph modeling Aggregate-oriented Data Modeling More degrees of freedom Embedding vs. referencing Denormalization and redundancy Big Data Technologies: NoSQL DBMS (Data Modeling) - SoSe 2017 35
NoSQL Database Systems Foundations Data Modeling NoSQL Application Development Techniques for Scalability, Availability and Consistency Decision Guidance: Select the Right DBMS Big Data Technologies: NoSQL DBMS (Data Modeling) - SoSe 2017 36