tezvyn:

NoSQL: Databases Beyond Rigid Tables

AI-drafted, machine-checkedSource: Wikipedia: NoSQLbeginner

NoSQL databases trade rigid tables for flexible models like documents or key-value pairs. This allows them to scale for massive, unstructured datasets from social media or IoT.

WHY IT EXISTS Relational databases, with their strict, predefined schemas, struggled to handle the massive volume and variety of data from modern web applications. A new approach was needed for systems that required massive scale and flexibility, especially when data structures change frequently.

THE MENTAL MODEL A relational (SQL) database is like a spreadsheet with fixed columns; you must define everything upfront. A NoSQL database is like a folder of documents (e.g., JSON files). Each document can have a different structure, but they are all stored in the same collection. The name 'Not only SQL' is a better guide than 'No SQL,' as it emphasizes coexistence and flexibility, not total replacement.

HOW IT WORKS Instead of storing all data in tables with rows and columns, NoSQL databases use one of several data models. The most common are: key-value stores (like a giant dictionary), document stores (storing JSON-like objects), wide-column stores (rows can have different columns), and graph databases (for relationships). Because they don't require a fixed schema, they can scale horizontally by adding more servers, which is often easier than scaling a single, large relational database server.

WHEN TO USE IT Use NoSQL for applications with large amounts of data that don't have a consistent structure, like user-generated content, IoT sensor data, or social media feeds. It's also ideal for systems that need to scale horizontally very quickly and can tolerate eventual consistency over strict, immediate consistency.

WHEN NOT TO USE IT Avoid NoSQL for systems that require complex queries with many joins or where strict ACID transactional guarantees are non-negotiable, such as in banking or financial systems. The flexibility comes at the cost of the powerful, standardized query and transaction features of SQL databases.

ONE CANONICAL EXAMPLE A social media platform stores user profiles. In a relational database, adding a new field like 'favorite_podcast' would require altering the entire users table. In a NoSQL document database, you can simply add the new field to one user's document without affecting any other user documents, allowing for rapid feature development.

Read the original → en.wikipedia.org

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.