MODULE 7
No SQL
NoSQL
• NoSQL, which stands for “not only SQL,”
• An approach to database design that provides
flexible schemas for the storage and retrieval
of data beyond the traditional table structures
found in relational database.
• "NoSQL" was only coined in the early 21st
century, triggered by the needs of Web 2.0
companies.
NoSQL
• Does not require a fixed schema, avoids joins, and is easy to
scale.
• Never follow the relational model it is either schema-free or
has relaxed schemas
• BASE stands for Basically Available, Soft state, Eventual
consistency
• The term "eventual consistency" means to have copies of
data on multiple machines to get high availability and
scalability
• NOSQL offer limited query capabilities
Features of No SQL
• Non-relational
• Schema Free
• Distributed
– Multiple NoSQL databases can be executed in a distributed fashion
Features of No SQL
• Non-relational
• Schema Free
• Distributed
– Multiple NoSQL databases can be executed in a distributed fashion
– Shared Nothing Architecture. This enables less coordination and higher distribution .
Comparison
• SQL databases are relational
– No SQL are non-relational.
• SQL databases use structured query language
and have a predefined schema.
– No SQL databases have dynamic schemas for
unstructured data.
• SQL databases are table based
– No SQL databases are document, key-value, graph
or wide-column stores.
Need of No SQL
• NoSQL databases are often better suited to
– Storing
– modeling structured
– semi-structured
– unstructured data
in one database
No SQL Database Examples
• MongoDB, CouchDB, CouchBase, Cassandra, HBase, Redis,
Riak, Neo4J are the popular
a. MongoDB, CouchDB, CouchBase , Amazon SimpleDB, Riak,
Lotus Notes are document-oriented NoSQL databases
b. Neo4J, InfoGrid, Infinite Graph, OrientDB, FlockDB are graph
databases.
Types
• NoSQL Databases are mainly categorized into
four types:
– Key-value pair
– Column-oriented
– Graph-based and Document-oriented
Every category has its unique attributes and
limitations.
Types of No SQL Databases
Key value pair based
• Data is stored in key/value pairs. It is designed in
such a way to handle lots of data and heavy load.
• They work best for shopping cart contents.
Column-oriented databases
• Column-oriented databases work on columns and are based on BigTable
paper by Google.
• Every column is treated separately. Values of single column databases are
stored contiguously.
Document Based Database
Document-Oriented NoSQL DB stores and retrieves data as a key
value pair but the value part is stored as a document.
Graph type Database
• A graph type database stores
entities as well the relations
amongst those entities.
• The entity is stored as a node
with the relationship as edges.
An edge gives a relationship
between nodes.
• Every node and edge has a
unique identifier.
• Graph base database mostly
used for social networks,
logistics, spatial data.
Advantages of NoSQL
• Simple to implement than using RDBMS
• It can serve as the primary data source for online applications.
• Handles big data which manages data velocity, variety, volume, and
complexity
• Excels at distributed database
• Easy Replication
• Can handle structured, semi-structured, and unstructured data with equal
effect
Disadvantages of NoSQL
• No standardization rules
• Doesn't work as well with relational data
• It does not offer any traditional database
capabilities, like consistency when multiple
transactions are performed simultaneously.
CAP Theorem
• The CAP Theorem states that it is impossible for a distributed computer
system to simultaneously provide all three of the following guarantees:
• Consistency (all nodes see the same data at the same time)
• Availability (a guarantee that every request receives a response about
whether it succeeded or failed)
• Partition tolerance (the system continues to operate despite arbitrary
message loss or failure of part of the system)
THANK YOU