SlideShare a Scribd company logo
Some
NoSQL
By "SQL" we mean :
  Relational DBs
So NoSQL:
Non-Relational
 The biggest difference
So, what is relational?
Data is represented by
Tables and Relations
 Relational model, created by IBM in 69
Data manipulation is done
       by queries
      grouped by transactions
What is the problem with
          that?
"It does not scale"
A common, but bad,
     answer!
Why is it common?
ACID
The 4 qualities of transactions on a relational model
Atomicity, Consistency,
  Isolation, Durability
Atomicity
Each transaction is "All or nothing".
Consistency
Each transaction brings the Database from a valid state
                      to another
Isolation
Concurrent transactions have no side effects
               (reentrancy)
Durability
Once a transaction is commited it remains so (even on
                      shutdown)
Brewer's CAP theorem
Of Consistency,
Availability and Partition
        tolerance
          Chose two
You cannot scale without
   Partition tolerance
    no mainframe would be that big!
You cannot afford
ignoring availability
Sorry customer our service is down again!
So to scale you have to
   drop consistency
  which means some stale data is ok. that is a
compromise. A risk to be taken and considered.
ACID means having
   Consistency
to scale you need an
     alternative
BASE
Basic Availability Soft-
state Eventual consistency
    details here : http://www.cs.berkeley.
  edu/~brewer/cs262b-2004/PODC-keynote.pdf
You drop Consistency for
   Eventual Consistency
That is the most important change for scaling purposes
All that is true!
So if Relational implies
ACID and ACID does not
         scale?
then: relational databases do not scale, right?
Wrong!
Why is the argument bad?
see Facebook
The worlds biggest hive of data
Facebook uses several
     datastores
   polyglotism, we will get to that
But most of facebook data
      is on MySQL
         and it scales
You can make your
relational data behave in
       a BASE way
   Given enough effort, time and money.
Should you?
it depends on your data
So what is the problem
with the relational model?
         The real one?
"If all you have is a
hammer, everything looks
        like a nail"
Abraham Maslow, The Psychology of Science, 1966, p.
                       15
We use it for
non-relational data
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)
Several layers just to
force our data to be
   something else
   AND to go back being our data!
This adds bugs
    in each layer
This adds performance
         costs
     in all those translations
This adds integration
         costs
Ever spent dev time making those layers work?
This adds Dev costs
You must jump hoops making your data behave
                relationally
What about NoSQL ?
Several data representations!
●   Key-Value
●   Document
●   Column-Family
●   Graph
●   XML-bases
●   Object
●   Grid
●   mixed (using several types)
●   etc.
Key-Value
Redis, Riak, CouchBase, etc.
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.
Key-Value Datastore: When to use?
●   Dictionaries
●   Session data
●   User preferences
●   Shopping cart
●   Anything whose content you do not want to
    scry or query.
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
Document
MongoDB, CouchDB, TerraStore, RavenDB, Lotus Notes,
                       etc.
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.
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.
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.
Column-Family
Hadoop, Cassandra, Amazon SimpleDB, Amazon
              DynamoDB etc.
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.
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
Column-Family Datastore:
When to avoid it?
● You need ACID
● You need aggregate results (sums,
  averages, etc)
● Your data is not tabular
Graph
Neo4J, Titan, FlockDB, OrientDB etc.
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.
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.
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)
Which one to chose?
The ones closer
 to your data
     yes plural
Polyglot Persistence
Different Datastores for different Data
For each slice of data you
      want to store
Ask what datastore model
would better represent it
Stop nailing screws!
How do you diagnose the
correct type of each data?
Linagora can help!
Some NoSQL
Questions?

More Related Content

PDF
SQL vs NoSQL, an experiment with MongoDB
PPTX
SQL vs NoSQL
PDF
SQL vs. NoSQL Databases
PDF
01 nosql and multi model database
PDF
Multi model-databases
PDF
SQL vs NoSQL | MySQL vs MongoDB Tutorial | Edureka
PPTX
Sql vs. NoSql
PPT
Trouble with nosql_dbs
SQL vs NoSQL, an experiment with MongoDB
SQL vs NoSQL
SQL vs. NoSQL Databases
01 nosql and multi model database
Multi model-databases
SQL vs NoSQL | MySQL vs MongoDB Tutorial | Edureka
Sql vs. NoSql
Trouble with nosql_dbs

What's hot (20)

PDF
Multi-model databases and node.js
PPTX
NoSQL with ASP.NET MVC
PDF
Nosql database presentation
PPTX
NoSQL Tel Aviv Meetup#1: NoSQL Data Modeling
PDF
Extensible Database APIs and their role in Software Architecture
PDF
SDEC2011 NoSQL Data modelling
PDF
Nosql data models
ODP
Graphing Your Data
PPTX
JSON as a SQL Datatype
PPTX
How Linked Data Can Speed Information Discovery
PDF
Data Pipline Observability meetup
ODP
Building next generation data warehouses
PPTX
473_LightningTalks.pptx
PPTX
Modeling JSON data for NoSQL document databases
PPTX
Database and types of database
PDF
Xml schema
PPTX
Databasics an intro to database systems
PPT
XML and Databases
PDF
Say Yes To No SQL
PDF
NoSQL Databases
Multi-model databases and node.js
NoSQL with ASP.NET MVC
Nosql database presentation
NoSQL Tel Aviv Meetup#1: NoSQL Data Modeling
Extensible Database APIs and their role in Software Architecture
SDEC2011 NoSQL Data modelling
Nosql data models
Graphing Your Data
JSON as a SQL Datatype
How Linked Data Can Speed Information Discovery
Data Pipline Observability meetup
Building next generation data warehouses
473_LightningTalks.pptx
Modeling JSON data for NoSQL document databases
Database and types of database
Xml schema
Databasics an intro to database systems
XML and Databases
Say Yes To No SQL
NoSQL Databases
Ad

Similar to Some NoSQL (20)

PPTX
Introduction to Data Science NoSQL.pptx
PPTX
Choosing your NoSQL storage
PPTX
Sql vs NoSQL
PPTX
The Rise of NoSQL and Polyglot Persistence
PPTX
PPTX
No sq lv2
PPTX
unit2-ppt1.pptx
PPTX
NoSQL.pptx
PPTX
NoSQL(NOT ONLY SQL)
PPTX
Module 2.2 Introduction to NoSQL Databases.pptx
PPTX
Big Data (NJ SQL Server User Group)
PPTX
cours database pour etudiant NoSQL (1).pptx
PPTX
Big Data Platforms: An Overview
PDF
NoSql and it's introduction features-Unit-1.pdf
PPTX
UNIT I Introduction to NoSQL.pptx
PPTX
Master.pptx
PDF
Oracle Week 2016 - Modern Data Architecture
PDF
NOSQL- Presentation on NoSQL
PDF
NOSQL in big data is the not only structure langua.pdf
PPTX
NoSQL databases - An introduction
Introduction to Data Science NoSQL.pptx
Choosing your NoSQL storage
Sql vs NoSQL
The Rise of NoSQL and Polyglot Persistence
No sq lv2
unit2-ppt1.pptx
NoSQL.pptx
NoSQL(NOT ONLY SQL)
Module 2.2 Introduction to NoSQL Databases.pptx
Big Data (NJ SQL Server User Group)
cours database pour etudiant NoSQL (1).pptx
Big Data Platforms: An Overview
NoSql and it's introduction features-Unit-1.pdf
UNIT I Introduction to NoSQL.pptx
Master.pptx
Oracle Week 2016 - Modern Data Architecture
NOSQL- Presentation on NoSQL
NOSQL in big data is the not only structure langua.pdf
NoSQL databases - An introduction
Ad

Recently uploaded (20)

PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Empathic Computing: Creating Shared Understanding
PPTX
A Presentation on Artificial Intelligence
PDF
KodekX | Application Modernization Development
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Cloud computing and distributed systems.
PPT
Teaching material agriculture food technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Modernizing your data center with Dell and AMD
PDF
cuic standard and advanced reporting.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Big Data Technologies - Introduction.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Machine learning based COVID-19 study performance prediction
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Empathic Computing: Creating Shared Understanding
A Presentation on Artificial Intelligence
KodekX | Application Modernization Development
Understanding_Digital_Forensics_Presentation.pptx
Chapter 3 Spatial Domain Image Processing.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Diabetes mellitus diagnosis method based random forest with bat algorithm
Cloud computing and distributed systems.
Teaching material agriculture food technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation_ Review paper, used for researhc scholars
Modernizing your data center with Dell and AMD
cuic standard and advanced reporting.pdf
Electronic commerce courselecture one. Pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Big Data Technologies - Introduction.pptx

Some NoSQL