0% found this document useful (0 votes)
15 views19 pages

Lec 17 Nosql

NoSQL databases are non-tabular, distributed databases that are designed to scale horizontally. They are often used for large volumes of data across many servers. NoSQL databases come in several forms including key-value, document, column family, and graph databases. Key advantages of NoSQL databases include their ability to handle big data workloads, provide high performance and scalability, and support flexible, schema-less data models.

Uploaded by

2028110
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views19 pages

Lec 17 Nosql

NoSQL databases are non-tabular, distributed databases that are designed to scale horizontally. They are often used for large volumes of data across many servers. NoSQL databases come in several forms including key-value, document, column family, and graph databases. Key advantages of NoSQL databases include their ability to handle big data workloads, provide high performance and scalability, and support flexible, schema-less data models.

Uploaded by

2028110
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

NoSQL

2
School of Computer Engineering
Database

Database

RDBMS NoSQL

OLAP OLTP

3
School of Computer Engineering
OLTP vs. OLAP
OLTP OLAP
Many short transactions Long transactions, complex queries
Example: Example:
‐ Update account balance ‐ Count the classes with fewer than 10 classes
‐ Add book to shopping cart ‐ Report total sales for each dept in each month
‐ Enroll in course

Queries touch small amounts of data Queries touch large amounts of data
(few records)
Updates are frequent Updates are infrequent
Concurrency is biggest performance Individual queries can require lots of resources
problem

4
School of Computer Engineering
NoSQL
 NoSQL database stands for "Not Only SQL" or "Not SQL."
 It is a non-relational database, that does not require a fixed schema, and avoids joins.
 It is used for distributed data stores and specifically targeted for Big Data, for
example Google or Facebook which collects terabytes of data every day for their
users.
 Traditional RDBMS uses SQL syntax to store and retrieve data for further insights.
Instead, a NoSQL database system encompasses a wide range of database
technologies that can store structured, semi-structured, and unstructured data.
 It adhere to Brewer’s CAP theorem.
 The tables are stored as ASCII files and each field is separated by tabs
 The data scale horizontally.

5
School of Computer Engineering
Why and Uses of NoSQL
Why: In today’s time data is becoming easier to access and capture through
third parties such as Facebook, Google+ and others. Personal user information,
social graphs, geo location data, user-generated content and machine logging
data are just a few examples where the data has been increasing exponentially.
To avail the above service properly, it is required to process huge amount of data
which SQL databases were never designed. The evolution of NoSql databases is
to handle these huge data properly.
Uses:

Log analysis

Where to use NoSQL? Social networking feeds

Time‐based data

6
School of Computer Engineering
Types of NoSQL Database
There are mainly four categories of NoSQL databases. Each of these categories
has its unique attributes and limitations.

Performance High High High Variable


Scalability High High Moderate Minimal
Flexibility High Variable (high) High Variable (low)
Functionality Variable Variable Variable Graph Theory
7
School of Computer Engineering
Key Value
Data is stored in key/value pairs. It is designed in such a way to handle lots of
data and heavy load. Key-value pair storage databases store data as a hash table
where each key is unique, and the value can be a JSON, BLOB, string, etc. It is one
of the most basic types of NoSQL databases. This kind of NoSQL database is used
as a collection, dictionaries, associative arrays, etc. Key value stores help the
developer to store schema-less data. They work best for shopping cart contents.
Redis, Dynamo, Riak are some examples of key-value store.
SQL
ID Name Age State
1 John 27 California

NoSQL – Key Value


Key (i.e. ID) Values
1 Name: John
Age:27
State: California
8
School of Computer Engineering
Document‐Based
Document-Oriented NoSQL DB stores and retrieves data as a key value pair but
the value part is stored as a document. The document is stored in JSON or XML
formats. The document type is mostly used for CMS (Content Management
Systems), blogging platforms, real-time analytics & e-commerce applications. It
should not use for complex transactions which require multiple operations or
queries against varying aggregate structures.
SQL NoSQL – Document‐Based
ID Name Age State Key (ID) Value (JSON)
1 John 27 California 1 {
“Name”: John
“Age”:27
“State”: California
}

9
School of Computer Engineering
JSON vs. XML format

10
School of Computer Engineering
Column‐Oriented vs. Row‐Oriented Database

11
School of Computer Engineering
Column‐Oriented vs. Row‐Oriented Database cont’d

Row Oriented Column Oriented


Data is stored and retrieved one row at a time and In this type of data stores, data are stored and
hence could read unnecessary data if some of the retrieve in columns and hence it can only able to
data in a row are required. read only the relevant data if required.

Records in Row Oriented Data stores are easy to In this type of data stores, read and write
read and write. operations are slower as compared to row‐
oriented.

Row‐oriented data stores are best suited for online Column‐oriented stores are best suited for online
transaction system. analytical processing.

These are not efficient in performing operations These are efficient in performing operations
applicable to the entire datasets and hence applicable to the entire dataset and hence enables
aggregation in row‐oriented is an expensive job or aggregation over many rows and columns.
operations.

12
School of Computer Engineering
Column‐Based Database
Column-oriented databases work
on column family and based on
BigTable paper by Google. Every
column is treated separately.
Values of single column
databases are stored
contiguously. They deliver high
performance on aggregation
queries like SUM, COUNT, AVG,
MIN etc. as the data is readily
available in a column. Such
NoSQL databases are widely used
to manage data warehouses,
business intelligence, CRM,
Library card catalogs etc.
13
School of Computer Engineering
Column‐Based cont’d

14
School of Computer Engineering
Graph‐Based
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.

15
School of Computer Engineering
Advantages of NoSQL
 Can be used as Primary or Analytic Data Source
 Big Data Capability
 No Single Point of Failure
 Easy Replication
 No Need for Separate Caching Layer
 Provides fast performance and horizontal scalability.
 Can handle structured, semi-structured, and unstructured data with equal effect
 NoSQL databases don't need a dedicated high-performance server
 Support Key Developer Languages and Platforms
 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 and multi-data center operations
 Eliminates the need for a specific caching layer to store data
 Offers a flexible schema design which can easily be altered without downtime or
service disruption

16
School of Computer Engineering
Disadvantages of NoSQL
 No standardization rules
 Limited query capabilities
 RDBMS databases and tools are comparatively mature
 It does not offer any traditional database capabilities, like consistency when
multiple transactions are performed simultaneously.
 When the volume of data increases it is difficult to maintain unique values as
keys become difficult
 Doesn't work as well with relational data
 The learning curve is stiff for new developers
 Open source options so not so popular for enterprises.

17
School of Computer Engineering
SQL vs. NoSQL
SQL NoSQL
Relational database Non‐relational, distributed database
Relational model Model‐less approach
Pre‐defined schema Dynamic schema for unstructured data
Table based databases Document‐based or graph‐based or wide
column store or key‐value pairs databases
Vertically scalable (by increasing system Horizontally scalable (by creating a cluster of
resources) commodity machines)
Uses SQL Uses UnQL (Unstructured Query Language)
Not preferred for large datasets Largely preferred for large datasets
Not a best fit for hierarchical data Best fit for hierarchical storage as it follows
the key‐value pair of storing data similar to
JSON
Emphasis on ACID properties Follows Brewer’s CAP theorem
18
School of Computer Engineering
SQL vs. NoSQL cont’d
SQL NoSQL

Excellent support from vendors Relies heavily on community support

Supports complex querying and data keeping needs Does not have good support for complex querying

Can be configured for strong consistency Few support strong consistency (e.g., MongoDB),
few others can be configured for eventual
consistency (e.g., Cassandra)

Examples: Oracle, DB2, MySQL, MS SQL, Examples: MongoDB, HBase, Cassandra, Redis,
PostgreSQL, etc. Neo4j, CouchDB, Couchbase, Riak, etc.

19
School of Computer Engineering

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy