Designing Data Intensive Applications - Ch 2 - Data Models and Query Languages

  Relational Model

Others that competed and did not last:
network model
hierarchical model
XML database
Object database

NOSQL: specialized query options, expressive data model

polyglot persistence

impedence layer : the mismatch when moving from OO applications to relational databases
Impedence is reduced by a translation layer like JSON

JSON (document databases):
flexible schema
better locality : sub categories in one place instead of complex joins
hard for many to many relations (easier in SQL)
closer to data structure used by app layer
schema on read instead of schema on write

network model
- tree structure like hierarchical but allowed multiple parents and so many-to-many
- pointers and access paths instead of joins in SQL
- complicated code even though efficient in small drives

SQL
- no access paths, just individual tables
- access paths on the fly using query optimizer
- can change indexes without changing table
- conurrent
- fault tolerant
- shredding 

Graph Model

Query Languages :

Imperative VS Declarative

Declarative :
CSS, SQL
select rec from table where animal is shark;
good for databases, good for web design

Imperative :
Java
for animal in animals, when animal = shark

MapReduce is used to perform querying across bulk data across many systems
NOSQL uses a limited form of map reduce - read only across many documents

Hybrid of imperative and declarative
map/collect
reduce / fold / inject

select month, animals where animal = shark group by month

mapreduce:

function map(){
emit(mon, this.animals);
},
function reduce(key,values){
return Array.sum(values);
},
query...

Graph data model :
Vertices with I edge and o edge and properties.
Edges with properties

For many to many
Better than recursive queries in sql
Can be stored as a SQL table

Rdf model designed to be shared across web
Difference from network model is that there is no nesting rules

Datalog made of rules (like functions) that can then be called with a graph like query.


Comments

Popular posts from this blog

Udacity - Data Engineering - Cloud Data Warehousing