39. Your App
Model Logic (the M in MVC)
Model Translator (ORM usually)
Database Abstraction Layer (avoid lock in)
SQL Generation (souped up concatenation)
SQL Interpreter
Database (Complex Algorithms)
40. Several layers just to
force our data to be
something else
AND to go back being our data!
48. Key-Value Datastore: What is it?
You store keys (identifiers) and values (pretty
much anything, serialized)
Just a quick way to store things under a name
and recover them using that name.
49. Key-Value Datastore: When to use?
● Dictionaries
● Session data
● User preferences
● Shopping cart
● Anything whose content you do not want to
scry or query.
50. Key-Value Datastore: When to avoid?
● You have relations
● You have multi-operational transactions
● You want to query the values
● You want to operate on sets of entries
52. Document Datastore: What is it?
As with the key-value, but your data is not
amorph is a document!
Each document behaves like an Hash-table, it
has entries of a given kind that may
themselves have entries (like a xml or json
file).
documents are schemaless, you have complete
liberty of what goes inside them.
53. Document Datastore: When to use?
● When you have documents!
○ Blogs
○ CMS
● When freedom of schema is required
○ Analytics
○ E-commerce products
● When you wanted a key-value but wanted
to query the values.
54. Document Datastore: When to avoid?
● You need complex/atomic transactions over
different documents
○ in that case you may have a relation, you may need
sql after all!
● The schema-free usage render your queries
impossible.
● You want to force a schema.
56. Column-Family Datastore:
What is it?
Data in tables of rows and columns like the
relational model but:
● Each row has a varying number of columns
(hence the name)
● Each row is timestamped for comparison,
expiring and conflict resolution.
● There is no master node; writing can be
scaled by adding nodes.
● A column may contain another row.
57. Column-Family Datastore:
When to use it?
● Logging
● Registering events
● Counters
● when you have massive concurrent writes
with small chances of collisions (facebook
uses for their internal messaging system)
● when your information has a due date
58. Column-Family Datastore:
When to avoid it?
● You need ACID
● You need aggregate results (sums,
averages, etc)
● Your data is not tabular
60. Graph Datastore: What is it?
Data is represented by nodes (objects)
connected by vertices (relations).
The very school definition of a graph.
The same data can represent several graphs.
Graph traversal may be persisted as a relation.
61. Graph Datastore: When to use it?
Anywhere you should already be using Graphs
on your application:
● Any relations (in the relational model
sense) that have no data.
● Social relations (friend of, employee, chief
of, etc)
● Dependency
● Geographical data
● Routing, dispatching etc.
62. Graph Datastore: When to avoid it?
Your application writes over large sets of
nodes commonly (writing to many nodes at
once is expensive)
Your relations carry payloads (in that case you
need sql)