> For the complete documentation index, see [llms.txt](https://yoan-thirion.gitbook.io/knowledge-base/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yoan-thirion.gitbook.io/knowledge-base/software-architecture/nosql.md).

# NoSQL

### Objectives :

* Understand what does NoSQL mean
* Understand the different kind of databases hidden behind this word

## Connection - 10'

* In pair list every Pros and Cons you have encountered with relational database
* List every relational database you have already used
* Group the answers

## Concepts - 20'

### Relational databases

* Persist data
* Concurrency control
* Manage transactions in an ACID way

### ACID

![](/files/-MRsVOKv4VVy9VD8mwOJ)

* Atomicity
  * "all or nothing"
  * One part fails => the entire transaction fails
* Consistency
  * Bring the database from one valid state to another
  * All defined rules, including constraints, cascades, triggers, and any combination are respected
* Isolation
  * Concurrent execution
    * Would be obtained if transactions were executed sequentially
* Durability
  * Transaction committed : it will remain

### Cons of relational databases

* Impedance mismatch
  * Relational data structures vs In-memory data structures
* Performance
* Distribution
* Cost

### NoSQL

![](/files/-MRsW0tO6L3-zetIjU0w)

### Different kind of NoSQL Databases

![](/files/-MRsW75xGBqkiacPMQlL)

### Why use NoSQL ?

* To improve programmer productivity : better matches an application needs&#x20;
* To improve data access performance&#x20;
  * Through some combination of handling larger data volumes, reducing latency&#x20;
* Large volumes of rapidly changing structured, semi-structured, and unstructured data
* Geographically distributed scale-out architecture&#x20;
  * Instead of expensive, monolithic architecture

## Concrete Practice - 20'

Let's play with a GraphDB call Neo4j for the next minutes :

* Connect to the [platform](https://sandbox.neo4j.com/)
* Play with the Cypher queries
* Play with the Graph Visualization

![](/files/-MRsXu6hH4Y2YYI816NK)

## Conclusion - 10'

{% hint style="success" %}
***NoSQL does not mean “Death of SQL”***
{% endhint %}

We can now create polyglot persistence :

* Uses different data storage technologies to handle varying data storage needs
* Can be applied : Anywhere in an organization/in a single application

Use the tool that fits the best your needs.

![](/files/-MRsYGMOP7oIzNpVLUdv)

### Remember the past

Think about the past few years, in which development you have made this kind of database would have been useful ?

* Why ?

### Resources

#### Key Value Stores

* Aerospike
* Apache Cassandra
* Berkeley DB
* Couchbase Server
* Redis
* Riak

#### Document DB

* CouchDB
* Elasticsearch
* MongoDB

#### Graph DB

* Neo4j
* OrientDB
* FlockDB

#### Wide Columns Family Stores

* Cassandra
* HBase
