Top Banner
Database Management Systems NoSQL
36

Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Jul 08, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Database Management Systems

◼ NoSQL

Page 2: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Why NoSQL?

◼ Better question: why relational databases?

Page 3: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant
Page 4: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Application vs. Integration

◼ What are you using the database for?–How does this effect...•Complexity?•Performance?•Development?

Page 5: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

The effect of scale

◼ Consider how the internet looks now compared to 15 years ago....–How did we come to meet the increase in demand?

Page 6: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Here comes NoSQL

◼ What is it?

◼ How is it different?

◼ Why should we be using it?

Page 7: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Aggregates

◼ How does a relational database store records?–What are the limitations of this?

Page 8: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

A relational data model

Page 9: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Relational data

Page 10: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

An aggregate data model

Page 11: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Aggregate Data

Page 12: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

A different aggregate data model

Page 13: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

A different set of data

Page 14: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Consequences

◼ How are these aggregates represented in relational databases?

◼ What benefits are gained from using these aggregates in this way?

◼ ACID Transactions

Page 15: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Schemaless Databases

◼ Under this model we do not require a schema–How is this possible?•Advantages?•Disadvantages?

◼ Are they actually schemaless?

Page 16: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Modeling for Data Access

Page 17: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Distribution

◼ One of the major benefits of NoSQL (why?)–Comes with one major drawback...

Page 18: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Single Server

◼ Is this really distribution?

◼ Why might you want to do it this way?

Page 19: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Sharding

Page 20: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Sharding

◼ What is the ideal case for # of users / servers?

◼ How do we decide how to split up the data?–What data will commonly be accessed together?

◼ What can we use to help us perform these tasks?

Page 21: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Primary-Secondary Replication

Page 22: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Primary-Secondary Replication

◼ How does this affect performance of reads? Writes?

◼ How does this affect data resilience?

◼ What about consistency?

Page 23: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Peer-to-Peer Replication

Page 24: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Peer-to-Peer Replication

◼ How does this affect performance of reads? Writes?

◼ How does this affect data resilience?

◼ What about consistency?

Page 25: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Combinations

Page 26: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Update Consistency◼ Imagine two people try to update the same piece of data at the same time–What happens?–What do we want to happen?

◼ Pessimistic vs. Optimistic

Page 27: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Read Consistency

Page 28: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Read Consistency

◼ Logical consistency–How do relational DBs handle this?

◼ How does NoSQL handle it?–Inconsistency window

◼ How does replication complicate this kind of consistency?

Page 29: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Read Consistency

Page 30: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Read Consistency◼ Read-your-writes consistency

◼ Session consistency–Sticky Sessions

Page 31: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Relaxing Consistency

◼ It is always possible to design a system that is consistent–Why might we want to sacrifice this?

◼ CAP Theorem

Page 32: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Partition Tolerance

Page 33: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

CAP Theorem◼ What is an example of a system without partition tolerance?–Should we aim for this?

◼ It is all about the trade off!

Page 34: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

CAP Theorem

◼ How can we improve consistency?

◼ How can we improve availability?

◼ Inconsistent writes–What about reads?

Page 35: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Quorums

◼ How many nodes do we actually need to get consistency?

◼ Write quorums

◼ Replication factor

◼ How does this affect reads?

Page 36: Database Management Systemsdshook/cse530/lectures/NoSQL.pdf · We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant

Review Questions

◼ We discussed how NoSQL databases are often schemaless, however there is often an implied schema. Explain what is meant by an implied schema.

◼ Give a brief description of each of the three parts of the CAP theorem.

◼ What is the practical implication of the CAP theorem as it applies to a distributed database?