📊

Understanding NoSQL Databases and Their Benefits

Mar 3, 2025

Lecture Notes: NoSQL Databases

Introduction to NoSQL Databases

  • Popularity: Widely used by large companies to manage extensive data and numerous queries per second.
  • Definition: A type of database that doesn't rely on traditional relational models.

Limitations of Relational Databases

  • Examples: MySQL, MariaDB, SQL Server.
  • Characteristics:
    • Store relational data efficiently.
    • Tight organization linking tables (e.g., customers, orders, products).
  • Scalability Issues:
    • Difficult to scale due to maintenance of relationships.
    • Capable of vertical scaling but limited in horizontal scaling.

Advantages of NoSQL Databases

  • Scalability:
    • Scale both vertically and horizontally.
    • Horizontal scaling compared to adding more buildings (more flexible).
  • Data Structure:
    • Dissolve costly relationships (key-value stores).
    • Simplified design allows better scalability.
    • Partitions for workload distribution; each server responsible for parts of database.
  • Partitioning:
    • Items identified by primary key.
    • Uses hash function to partition data into keyspace.

NoSQL Database Characteristics

  • Schemaless:
    • Allows varied structures for database items.
    • Advantageous for evolving applications and data structures.
  • Eventual Consistency:
    • Data replication may cause temporary inconsistencies.
    • Trades some consistency for performance, but consistency options are available.

Comparison with Relational Databases

  • Limitations:
    • Retrieval by primary key only, less efficient for complex queries.
    • Relational databases excel in complex data retrieval.
  • Complementary Use: Both databases have distinct strengths and are expected to coexist.

Examples of NoSQL Databases

  • Cloud Providers:
    • AWS DynamoDB, Google Cloud BigTable, Azure CosmosDB.
  • Self-hosted Options:
    • Cassandra, Scylla, CouchDB, MongoDB.
  • Case Study: Amazon's peak at 45 million requests/sec during Prime Day 2019.

Origin of the Term "NoSQL"

  • Interpretations:
    • "Not only SQL": Some NoSQL databases understand SQL.
    • "Non-relational": Reflects inability to store relational data easily.

Conclusion

  • Future Outlook: Expect continued coexistence of NoSQL and relational databases, each with unique advantages.
  • Additional Note: Subscription prompt for further learning.