NoSQL Databases Assignment Help | What are NoSQL Databases?



In this blog we will cover all below topics:

  • Disadvantages of Relational DBs

  • What are NoSQL Databases?

  • RDBMS vs NoSQL

  • CAP Theorem

  • Intro to MongoDB

  • Working with MongoDB & Python

  • Exercise

First we have flashback about relation database which I discussed in previous blog:


Relational Databaseis a database that stores data as a set of Tables (Relations) with:


Set of Columns

  • One column is called a Primary Key

  • All values in a Column have the same data type


Set of Rows

  • Rows have entries that correspond to Columns

  • Each Row is Unique based on the Primary Key

  • Primary Key must have a unique value (not NULL or empty)

  • Row Entries not in the Primary Key do not have to be unique

  • Non-Primary Keys entries for a Row can be NULL or empty

  • Rows of data in their raw form are stored in Tuples

Relational Database Management Systems (RDBMS), a set of programs for managing and facilitating all the operations on a database while maintaining the integrity and security of the data, e.g. Oracle RDBMS, IBM DB2, PostgreSQL


Disadvantages of Relational DBs

Relational DBs were not built for Big Data distributed applications

  • Joins are expensive

  • Difficult to scale horizontally

  • Impedance mismatch

  • Costly hardware & maintenance

  • Partition tolerance issues

  • Weak performance (speed)

  • High availability limitations


What’s NoSQL?

  • A NoSQL database supports storage and retrieval of data with less constrained consistency than a traditional relational database

  • No SQL systems are also referred to as "NotonlySQL“ to emphasize that they do in fact allow SQL-like query languages to be used.



  • Poorly named—confuses a data model (relational) for a query language (SQL)

  • Should have been called Not Only Relational

  • NoSQL family contains a variety of models under this umbrella


NoSQL Database Types

  • Key-Value Stores, e.g. Redis, Riak

  • Document Databases, e.g. MongoDB

  • Column-Oriented, e.g. Cassandra, Hbase

  • Graph Databases, e.g. Neo4j, JenaDB




























Key-Value Stores

  • Simplest type of NoSQL databases

  • Main idea – use of a hash table

  • Access values using keys (strings)

  • No data format enforcement

  • Data model: (key, value) pairs

  • Basic Operations:

1. Insert(key, value)

2. Fetch(key)

3. Update(key)

4. Delete(key)













Column Family, Column-Oriented or Wide-Column Stores

  • Contains columns of related data

  • Key is mapped to a value that is a set of columns

  • The column is lowest/smallest instance of data.

  • It is a tuple that contains a name, a value and a timestamp



















Document-Oriented Stores

  • Pair each key with a complex data structure, e.g. JSON document

  • Indexes are done via B-Trees.

  • Documents can contain many different key-value pairs, or key-array pairs, or even nested documents.




















Graph-Based Databases

  • Based on graph data model

* Node: entity (person, place, etc.)

* Relationship between nodes

  • Use graph algorithms

  • Scale vertically, no clustering

  • Support ACID transactions

  • Millions of operations per second

  • More on these in Week 7




















NoSQL Characteristics: Performance Over Perfection







Sharding

  • Data collection can be split into pieces, or shards

  • DBMS does not have to access the entire collection

  • •Each shard may be stored in separate nodes


Replication

  • Each shard can be replicated several times

  • Each replica is stored on a separate node


NoSQL Characteristics: Indexing

  • A way to optimize the performance of a database by minimizing the number of disk accesses required when a query is processed.

  • Data structure technique which is used to quickly locate and access the data in a database

  • More on this when we discuss MongoDB, and even more we get to Elasticsearch






















Relational vs NoSQL DBMS