Get familiar with NoSQL Database
Understanding NoSQL Database
- important features of NoSQL
- Schema Flexibility: NoSQL databases do not require a predefined schema
- Horizontal Scalability: scale out by distributing data across multiple servers
- High Availability and Fault Tolerance: built-in replication and sharding features
- Performance: Optimized for specific use cases
- Diverse Data Models: support various data models
- Cost-Effectiveness: the ability to scale out using commodity hardware
Introduction to NoSQL
- Two types of databases
- relational databases
- non-relational databases: often called as NoSQL databases
- NoSQL is used to store large quantities of complex and diverse data
- MongoDB is one of the most established NoSQL databases
- data aggregation
- ACID
- atomicity
- consistency
- isolation
- durability
- horizontal scaling
- charts
Relational Database Vs NoSQL
- Relational Database Management
- store structured data
- the data is stored in the form of tables that consists of tows and columns
- the tables can have relationships with other tables
- NoSQL Database Management System
- store unstructured and semi-structured data
- allow you to store the data without a schema and also support dynamic schema
- also support dynamic schema
Feature | Relational Database | NoSQL Database |
---|---|---|
schema | follows a rigid schema | does not impose a rigid schema |
data model/storage structure | 1. data is stored in tables 2. each record is stored as a row | 1. The data is stored in different formats 2. the standard storage structure are documents, graphs, key-values and wide columns |
normalization | 1. used to remove duplicate data and avoid data anomalies 2. RDB use it to prevents data anomalies | data can be normalized |
scaling | hard to scale and are generally scaled vertically | both vertical and horizontal scaling |
Types of NoSQL
- Key-value
- Image stores
- Key-based filesystems
- Object cache
- Systems designed to scale
- Column family
- Web crawler results
- Big data problems that can relax consistency rules
- Graph
- Social networks
- Fraud detection
- Relationship-heavy data
- Document
- High-variability data
- Document search
- Integration hubs
- Web content management
- Publishing
Key features of NoSQL
- Dynamic schema: do not have a fixed schema
- Horizontal scalability: scale out by adding more nodes to a database cluster
- Document-based: Some NoSQL databases, such as MongoDB, use a document-based data model,. Data is stored in a schema-less semi-structured format, such as JOSN or BSON
- Key-value-Based: Other NoSQL databases, such as Redis, use a key-value data model. Data is stored as a collection of key-value pairs
- Column-bases: Some NoSQL databases, such as Cassandra, use a column-based data model. Data is organized into columns instead of rows
- Distributed and high availability: highly available and automatically handle node failures and data replication
- Flexibility: support for multiple data types and changing data structures
- Performance: optimized for high performance and can handle a high volume of reads and writes
Advantage and Disadvantage of NoSQL
- Advantages
- High scalability
- Flexibility
- High availability
- Scalability
- Performance
- Cost-effectiveness
- Agility
- Disadvantages
- Lack of standardization
- Lack of ACID co,pliance
- Narrow focus
- Open-source
- Lack of support for complex queries
- Lack of maturity
- Management challenge
- GUI is not available
- Backup
- Large document size
When Should NoSQL be used
- When a huge amount of data needs to be stored and retrieved.
- The relationship between the data you store is not that important
- The data changes over time and is not structured.
- Support of Constraints and Joins is not required at the database level
- The data is growing continuously and you need to scale the database regularly to handle the data.
Understanding the MongoDB
Why MongoDB
- Flexible Schema
- Scalability
- High Performance
- Agile Development