9 NoSQL Database
9 NoSQL Database
As in Syllabus:
(1) NoSQL Data Models.
(2) Comparisons of various NoSQL Databases.
(3) CAP Theorem.
(4) Sorage Layout.
(5) Query models.
(6) Key-Value Stores.
(7) Document-databases – Apache CouchDB, MongoDB.
(8) Column Oriented Databases – Google’s Big Table, Cassandra.
Text Book:
Andreas Meier, Michael Kaufmann, “SQL & NoSQL Databases: Models, Languages, Consistency
Options and Architectures for Big Data Management”, Springer Verlag 2019
Chapter 1, pp. 1 to 23, Chapter 4, pp. 135, Chapter 7, pp. 201 & Internet materials.
Relation Relational Database
Management System
Structured Query
Language (SQL)
1.3 Big
Data
The term Big Data is used to label large volumes of data that push the
limits of conventional software.
This data is usually unstructured (Sect. 5.1) and may originate from a wide
variety of sources: social media postings, e-mails, electronic archives with
multimedia content, search engine queries, document repositories of
content management systems, sensor data of various kinds, rate
developments at stock exchanges, traffic flow data and satellite images,
smart meters in household appliances, order, purchase, and payment
processes in online stores, e-health applications, monitoring systems, etc.
1.3 Big
Data
There is no binding definition for Big Data yet, but most data specialists will
agree
on three v’s.
(1)volume (extensive amounts of data),
(2)variety (multiple formats, structured, semi-structured, and
unstructured data), and
(3) velocity
Gartner Group’s(high-speed
IT glossaryand real-time
offers processing).
the following definition:
1.4 NoSQL
Databases
The term NoSQL is now used for any nonrelational data
management approaches meeting two criteria:
• Shortest path: The shortest path between two nodes of a graph is the
one with the least edges.
The database management system then calculates all patterns meeting the criteria by
analyzing the possible paths (connections between nodes via edges).
This graph shows a segment of a graph database on
movies and actors.
For instance, the Cypher query to It uses the following basic query elements:
find the year the movie ‘The Matrix’ • MATCH: Specification of nodes and edges, as well as
was released would be: declaration of search patterns.
Text Book:
Andreas Meier, Michael Kaufmann, “SQL & NoSQL Databases: Models, Languages, Consistency
Options and Architectures for Big Data Management”, Springer Verlag 2019
Chapter 1, pp. 1 to 23, Chapter 4, pp. 135, Chapter 7, pp. 201 & Internet materials.
NoSQL Chapter 7, Page NO: 201
Database
The term NoSQL was first used in 1998 for a database that (although
relational) did not have an SQL interface.
The growing popularity of global web services saw an increase in the use
of web-scale databases, since there was a need for data management
systems that could handle the enormous amounts of data generated by
web services.
NoSQL
Database
Relational/SQL database systems are much more than mere data
storage systems. • These SQL functionalities offer
numerous benefits regarding data
They provide a large degree of processing logic:
consistency and security.
• Powerful declarative language
constructs • This goes to show that SQL databases
• Schemas and metadata are mainly designed for integrity and
transaction protection, as required in
• Consistency assurance
banking applications or insurance
• Referential integrity and triggers software, among others.
• Recovery and logging
• Multi-user operation and • However, since data integrity control
synchronization requires much work and processing
power, relational databases quickly
• Users, roles, and security • The
reachpowerfulness
their of the
limits withdatabase
large
• Indexing management
amounts of data. system is
disadvantageous for efficiency and
performance, as well as for flexibility in
data processing.
NoSQL
Database
• Column family
databases
• Document stores
•Illustration
Graph databases
of an XML Example of a graph
document represented by Example of a document database with user data of
tables. store. a website.
Core NoSQL technologies
are:
• Document stores
• Graph databases
Key-Value
Store
The simplest way of storing data is assigning a value to a variable or a
key.
The simplest database model possible is data storage that stores a data
object as stores,
In key-value a value for another
a specific data
value can be storedobject aswith
for any key key.a simple command, such as
SET.
Below is an example in which data for users of a website is stored: first name, last name, e-
mail, and encrypted password.
Data objects can be retrieved with a simple
query using the key, with command GET
• This allows for the distribution of the database onto a large number of
individual machines.
• Key-value stores
• Column family
databases
• Document stores
• Graph databases
Column family
databases
Even though key-value stores are able to process large amounts
of data performantly, their structure is still quite elementary.
Look at the above image, to perform a query like "average price" for all dates, In row-
oriented databases we have to read over large areas, in column-oriented databases the
prices are stored as one sequential region and we can read just that region.
Each column is identified by a combination of the column family and a column qualifier, which is a
unique name within the column family.
Each cell contains a unique timestamped version of the data for that row and column.
Storing multiple cells in a column provides a record of how the stored data for that row and column
has changed over time.
Bigtable tables are sparse; if a column is not used in a particular row, it does not take up any space.
An example…
Additional Examples….
Column family Bigtab In Bigtable, a table has three dimensions: It maps
databases le an entry of the database for one row and one
column at a certain time as a string:
• Key-value stores
• Column family
databases
• Document stores
• Graph databases
Document • Document stores store structured data in records
Stores which are called documents.
For every user key with the attribute _id, an This nested structure lists the date of the last
object containing all user information, such as visit to the website as the associated value.
Document
Stores
To summarize, a document store is a database
management system with the following
properties:
• It is a key-value store.
Document-databases
• Apache CouchDB,
• MongoDB
Core NoSQL technologies
are:
• Key-value stores
• Column family
databases
• Document stores
• Graph databases
DBs to Practice…
• Object Relational Database – SQL
• NoSQL databases
• Document Store – MongoDB
• Columnar DB – Cassandra