0% found this document useful (0 votes)
34 views22 pages

Unit Iii

Uploaded by

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

Unit Iii

Uploaded by

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

UNIT-III

NOSQL DATA MANAGEMENT


• Introduction to NoSQL,
• Key Features of NoSQL,
• Advantages and Disadvantages of NoSQL,
• Types of NoSQL database,
• Difference between views and materialized views in SQL,
• Distribution models: sharding, master-slave
replication, peer-peer replication, sharing and replication,
• CRUD Operations.
Introduction to NoSQL
NoSQL is a type of database management system (DBMS) that is designed to handle
and store large volumes of unstructured and semi-structured data. Unlike traditional
relational databases that use tables with pre-defined schemas to store data, NoSQL
databases use flexible data models that can adapt to changes in data structures and are
capable of scaling horizontally to handle growing amounts of data.

What is NoSQL?

NoSQL Database is a non-relational Data Management System, that does not require a
fixed schema. It avoids joins, and is easy to scale. The major purpose of using a
NoSQL database is for distributed data stores with humongous data storage needs.
NoSQL is used for Big data and real-time web apps. For example, companies like
Twitter, Facebook and Google collect terabytes of user data every single day.

NoSQL database stands for “Not Only SQL” or “Not SQL.” Though a better term
would be “NoREL”, NoSQL caught on. Carl Strozz introduced the NoSQL concept in
1998.
The concept of NoSQL databases became popular with Internet giants like Google,
Facebook, Amazon, etc. who deal with huge volumes of data. The system response
time becomes slow when you use RDBMS for massive volumes of data.
To resolve this problem, we could “scale up” our systems by upgrading our existing
hardware. This process is expensive.
Brief History of NoSQL Databases

● 1998- Carlo Strozzi use the term NoSQL for his lightweight, open-
source relational database
● 2000- Graph database Neo4j is launched
● 2004- Google BigTable is launched
● 2005- CouchDB is launched
● 2007- The research paper on Amazon Dynamo is released
● 2008- Facebooks open sources the Cassandra project
● 2009- The term NoSQL was reintroduced
Key Features of NoSQL

Dynamic schema: NoSQL databases do not have a fixed schema


and can accommodate changing data structures without the need
for migrations or schema alterations.

Horizontal scalability: NoSQL databases are designed to scale out


by adding more nodes to a database cluster, making them well-
suited for handling large amounts of data and high levels of traffic.

Document-based: Some NoSQL databases, such as MongoDB, use


a document-based data model, where data is stored in semi-
structured format, such as JSON or BSON.
Key-value-based: Other NoSQL databases, such as Redis, use a key-
value data model, where data is stored as a collection of key-value
pairs.
Column-based: Some NoSQL databases, such as Cassandra, use a
column-based data model, where data is organized into columns instead
of rows.

Distributed and high availability: NoSQL databases are often


designed to be highly available and to automatically handle node
failures and data replication across multiple nodes in a database cluster.

Flexibility: NoSQL databases allow developers to store and retrieve


data in a flexible and dynamic manner, with support for multiple data
types and changing data structures.

Performance: NoSQL databases are optimized for high performance


and can handle a high volume of reads and writes, making them
suitable for big data and real-time applications.
Advantages of NoSQL: There are many advantages of working with NoSQL databases
such as MongoDB and Cassandra. The main advantages are high scalability and high
availability.

• High scalability : NoSQL databases use sharding for horizontal scaling.


Partitioning of data and placing it on multiple machines in such a way that the
order of the data is preserved is sharding. Vertical scaling means adding more
resources to the existing machine whereas horizontal scaling means adding more
machines to handle the data. Vertical scaling is not that easy to implement but
horizontal scaling is easy to implement. Examples of horizontal scaling databases
are MongoDB, Cassandra, etc. NoSQL can handle a huge amount of data
because of scalability, as the data grows NoSQL scale itself to handle that data in
an efficient manner.
• Flexibility: NoSQL databases are designed to handle unstructured or semi-
structured data, which means that they can accommodate dynamic changes to the
data model. This makes NoSQL databases a good fit for applications that need to
handle changing data requirements.
• High availability : Auto replication feature in NoSQL databases makes it
highly available because in case of any failure data replicates itself to the

previous consistent state.


• Scalability: NoSQL databases are highly scalable, which means that
they can handle large amounts of data and traffic with ease. This makes
them a good fit for applications that need to handle large amounts of data
or traffic
• Performance: NoSQL databases are designed to handle large amounts
of data and traffic, which means that they can offer improved
performance compared to traditional relational databases.
• Cost-effectiveness: NoSQL databases are often more cost-effective
than traditional relational databases, as they are typically less complex
and do not require expensive hardware or software.
Disadvantages of NoSQL: NoSQL has the following disadvantages.

1. Lack of standardization : There are many different types of NoSQL


databases, each with its own unique strengths and weaknesses. This lack of
standardization can make it difficult to choose the right database for a specific
application
2. Lack of ACID compliance : NoSQL databases are not fully ACID-compliant,
which means that they do not guarantee the consistency, integrity, and
durability of data. This can be a drawback for applications that require strong
data consistency guarantees.
3. Narrow focus : NoSQL databases have a very narrow focus as it is mainly
designed for storage but it provides very little functionality. Relational
databases are a better choice in the field of Transaction Management than
NoSQL.
4. Open-source : NoSQL is open-source database. There is no reliable
standard for NoSQL yet. In other words, two database systems are likely to
be unequal.
1. Lack of support for complex queries : NoSQL databases are not designed to handle
complex queries, which means that they are not a good fit for applications that require
complex data analysis or reporting.
2. Lack of maturity : NoSQL databases are relatively new and lack the maturity of traditional
relational databases. This can make them less reliable and less secure than traditional
databases.
3. Management challenge : The purpose of big data tools is to make the management of a large
amount of data as simple as possible. But it is not so easy. Data management in NoSQL is much
more complex than in a relational database. NoSQL, in particular, has a reputation for being
challenging to install and even more hectic to manage on a daily basis.
4. GUI is not available : GUI mode tools to access the database are not flexibly available in the
market.
5. Backup : Backup is a great weak point for some NoSQL databases like MongoDB. MongoDB
has no approach for the backup of data in a consistent manner.
6. Large document size : Some database systems like MongoDB and CouchDB store data in
JSON format. This means that documents are quite large (BigData, network bandwidth, speed),
and having descriptive key names actually hurts since they increase the document size.
Types of NoSQL database
NoSQL databases are generally classified into four main categories:

1. Document databases: These databases store data as semi-structured documents,


such as JSON or XML, and can be queried using document-oriented query
languages.
2. Key-value stores: These databases store data as key-value pairs, and are
optimized for simple and fast read/write operations.
3. Column-family stores: These databases store data as column families, which are
sets of columns that are treated as a single entity. They are optimized for fast and
efficient querying of large amounts of data.
4. Graph databases: These databases store data as nodes and edges, and are
designed to handle complex relationships between data.

NoSQL databases are often used in applications where there is a high volume of data that
needs to be processed and analyzed in real-time, such as social media analytics, e-
commerce, and gaming. They can also be used for other applications, such as content
management systems, document management, and customer relationship management.
1 Document databases
A document database stores data in JSON, BSON, or XML documents (not Word
documents or Google Docs, of course). In a document database, documents can be
nested. Particular elements can be indexed for faster querying.

Documents can be stored and retrieved in a form that is much closer to the data
objects used in applications, which means less translation is required to use the data in
an application. SQL data must often be assembled and disassembled when moving
back and forth between applications and storage.

Document databases are popular with developers because they have the flexibility to
rework their document structures as needed to suit their application, shaping their
data structures as their application requirements change over time. This flexibility
speeds development because, in effect, data becomes like code and is under the
control of developers. In SQL databases, intervention by database administrators may
be required to change the structure of a database.
The most widely adopted document databases are usually implemented with a
scale-out architecture, providing a clear path to scalability of both data volumes
and traffic.

Use cases include ecommerce platforms, trading platforms, and mobile app
development across industries.
2 Key-value stores

The simplest type of NoSQL database is a key-value store. Every data


element in the database is stored as a key value pair consisting of an
attribute name (or "key") and a value. In a sense, a key-value store is like a
relational database with only two columns: the key or attribute name (such
as "state") and the value (such as "Alaska").

Use cases include shopping carts, user preferences, and user profiles.
3 Column-oriented databases

While a relational database stores data in rows and reads data row by row, a
column store is organized as a set of columns. This means that when you
want to run analytics on a small number of columns, you can read those
columns directly without consuming memory with the unwanted data.
Columns are often of the same type and benefit from more efficient
compression, making reads even faster. Columnar databases can quickly
aggregate the value of a given column (adding up the total sales for the year,
for example). Use cases include analytics.

Unfortunately, there is no free lunch, which means that while columnar


databases are great for analytics, the way in which they write data makes it
very difficult for them to be strongly consistent as writes of all the columns
require multiple write events on disk. Relational databases don't suffer from
this problem as row data is written contiguously to disk.
4 Graph databases

A graph database focuses on the relationship between data elements. Each element
is stored as a node (such as a person in a social media graph). The connections
between elements are called links or relationships. In a graph database, connections
are first-class elements of the database, stored directly. In relational databases, links
are implied, using data to express the relationships.

A graph database is optimized to capture and search the connections between data
elements, overcoming the overhead associated with JOINing multiple tables in SQL.

Very few real-world business systems can survive solely on graph queries. As a result
graph databases are usually run alongside other more traditional databases.

Use cases include fraud detection, social networks, and knowledge graphs.

As you can see, despite a common umbrella, NoSQL databases are diverse in their
data structures and their applications.
Difference between Relational database and NoSQL

1. Relational Database :
RDBMS stands for Relational Database Management Systems. It is
most popular database. In it, data is store in the form of row that is in
the form of tuple. It contain numbers of table and data can be easily
accessed because data is store in the table.
2. NoSQL :
NoSQL Database stands for a non-SQL database. NoSQL database
doesn’t use table to store the data like relational database. It is used for
storing and fetching the data in database and generally used to store
the large amount of data. It supports query language and provides
better performance.
Relational Database NoSQL

It is used to handle data coming in low velocity. It is used to handle data coming in high velocity.

It gives only read scalability. It gives both read and write scalability.

It manages structured data. It manages all type of data.

Data arrives from one or few locations. Data arrives from many locations.

It supports complex transactions. It supports simple transactions.

It has single point of failure. No single point of failure.

It handles data in less volume. It handles data in high volume.

Transactions written in one location. Transactions written in many locations.

support ACID properties compliance doesn’t support ACID properties

Its difficult to make changes in database once it is defined Enables easy and frequent changes to database

schema is mandatory to store the data schema design is not required


Difference between Views and Materialized Views in SQL
The main constituent of any database is its tables, in order to make data accessibility custom
there is concept of Views in other words we can say that with the help of Views of a table we
can restrict any user to access only that data which is supposed to be accessed by him.
Now on the basis of characteristic and features of the views we can distinguish between Views
and Materialized Views.

Views in SQL

Views are the logical and virtual copy of a table that is created by executing a ‘select query’
statement. The views are not stored anywhere on the disk. Thus, every time, a query has to be
executed when certain data is required. But, the query expression is stored on the disk.

Views do not have a storage/update cost associated with it. Views are designed with a specific
architecture, which means there is an SQL standard to define a view. Views are used when
data has to be accessed infrequently, but data gets updated frequently.
Materialized Views in SQL
Materialized views are the views whose contents are computed and stored. Materialized views are also
a logical virtual table, but in this case the result of the query is stored in the table or the disk. The
performance of the materialized views is better than normal views. This is because the data is stored on
the disk.

Sometimes, materialized views are also called as "indexed views" because the table created after the
query is indexed and can be accessed faster and efficiently. Materialized Views are used when data is to
be accessed frequently and data in table not get updated on frequent basis.

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