AD JB Toolbox 01 EN

What Is NoSQL? Data Models, SQL Differences and When to Use It

NoSQL databases are a family of databases that use models such as documents, key-value pairs, wide columns and graphs rather than relying on the relational table model. Choose one for the shape of your data and the operations your application needs; the NoSQL label alone does not guarantee faster queries or simpler design.

SQL (Structured Query Language) is a language for querying and manipulating data, while NoSQL is a category covering multiple models. “Not Only SQL” is one way to explain the name; it does not mean every product forbids SQL. The AWS NoSQL overview describes the different models and purposes.

The four main NoSQL data models

These categories describe how data is represented. One product may support multiple models, and products in the same category can differ in query capabilities and operation.

Model Basic representation Workload to consider Examples
Key-value A unique key and its associated value Cache or session lookups by known keys Redis, Amazon DynamoDB
Document Documents with fields, arrays and nested objects Product catalogs with varying attributes, user profiles MongoDB
Wide-column Rows or partitions organized by keys and columns Event records queried by device or time range Apache Cassandra, Bigtable
Graph Nodes for entities and edges for relationships Recommendations, dependencies and path traversal Neo4j

Key-value databases

A key-value model looks up a value using a key such as session:abc123. Consider it when access is predictable, such as retrieving a session by its ID. Searching arbitrary conditions inside values requires checking the particular product’s indexing and query features.

Values need not be plain strings. Redis supports hashes, lists, sets and sorted sets alongside strings, as documented in its data-type reference. For a cache, also decide where authoritative data lives, when entries expire and what happens when a cached entry is missing.

Document databases

A document groups an item’s fields, arrays and nested objects. JSON (JavaScript Object Notation) is a text format for expressing such structures; MongoDB stores documents using BSON (Binary JSON). Consider documents for items with different attributes or for data commonly read together on one screen.

Choose between embedding related information in a document and referencing another document’s identifier according to access frequency, size and updates. Copying an address into every order can simplify reads, but you must decide what the copy means and how it is maintained. The MongoDB modeling guide recommends designing around access patterns.

Wide-column databases

Wide-column models organize data around row or partition keys and columns. Bigtable uses a map sorted by row key and groups related columns into column families. Its storage-model documentation explains rows, columns and families.

A wide-column store should not be treated as the same thing as an analytical columnar store that groups a column’s values together. Cassandra requires query-oriented table and partition design and does not support relational joins. Its data-modeling introduction explains why you should first identify questions such as “read this device’s records for this period.” Check that the candidate supports your required range queries and aggregations.

Graph databases

A graph represents entities, such as people, products or servers, as nodes and their connections as edges. Consider it for questions that follow relationships, such as identifying services affected by a server failure.

Graphs can also store attributes. Neo4j’s property graph model allows properties on both nodes and relationships, as explained in its graph-concepts guide. A graph model does not make every query fast; define traversal depth, relationship types and path conditions.

How does NoSQL differ from a relational database?

A relational database management system (RDBMS) organizes data using tables, keys and constraints. It provides a useful basis for joining related records and applying shared rules. A NoSQL product offers operations appropriate to its model, so compare how each candidate answers your application’s questions rather than copying an existing schema unchanged.

Decision area What to examine in a relational model What to examine in a NoSQL model
Structure Columns, types, keys and constraints Documents, keys, partitions or graph relationships
Queries and relationships Joins, aggregations and varied filters Embedding, references, key lookups or graph traversal
Change and validation Schema changes and existing-data impact Required fields, types and versioning even with flexible structures
Transactions and consistency Isolation and updates across tables Supported scope, deployment requirements and read/write settings
Scaling and operation Indexes, replication, distribution and operational complexity Distribution keys, replicas, rebalancing, cost and recovery

Storing JSON does not automatically require NoSQL. PostgreSQL, for example, offers JSON types and indexing for jsonb; see its JSON-type documentation. Keeping relational rules and transactions while using flexible attributes for part of the data is also a candidate design.

A flexible schema still needs design

A schema defines structure and rules, such as field names, types and required values. Even if documents may have different fields, an application needs predictable data. This fictional JSON catalog illustrates two products with different attributes:

[
  {
    "product_id": "book-101",
    "name": "Database Basics",
    "price_krw": 24000,
    "attributes": {
      "author": "Mina Kim",
      "pages": 320
    }
  },
  {
    "product_id": "headphones-201",
    "name": "Wireless Headphones",
    "price_krw": 79000,
    "attributes": {
      "wireless": true,
      "battery_hours": 30
    }
  }
]

Both products share product_id, name and price_krw, but their nested attributes differ. A document structure expresses that variation naturally. Mixing numbers and strings in the same price field, however, can complicate sorting and calculation, so define allowed types and missing-value handling.

MongoDB supports validation rules for types and value ranges; its schema-validation documentation explains how to apply rules where needed. Cassandra’s CQL (Cassandra Query Language), by contrast, defines columns and types when a table is created, as shown in its table-definition reference. “Every NoSQL database is schemaless” is therefore inaccurate.

JSON describes a structure; it is not inherently unstructured data. Separately decide whether images and videos belong inside a database or in object storage with their locations and metadata in a database. File size, delivery requirements and management needs affect that choice.

Check transaction and consistency guarantees per product

Transaction support and scope

A transaction treats changes as a unit of work. ACID means Atomicity, Consistency, Isolation and Durability. For changes that must succeed or fail together, such as creating an order and reducing inventory, establish the required guarantees first.

NoSQL does not imply an absence of transactions. MongoDB supports multi-document transactions on replica sets and sharded clusters, with guarantees affected by deployment and read/write settings; see its transaction documentation. DynamoDB also provides transactional APIs (Application Programming Interfaces), but has restrictions including the supported targets and Region scope. Its transaction reference explains these boundaries.

What can a read return just after a write?

Replication behavior matters too. With eventually consistent reads, a recently completed write may not yet appear in a read result. Define requirements per user action: can an order temporarily be absent immediately after the user saves it?

DynamoDB tables and local secondary indexes can use strongly consistent reads, while reads from global secondary indexes and streams are eventually consistent. See its read-consistency documentation for differences by query target. ACID consistency within a transaction and consistency of reads across replicas are different concerns.

Horizontal scaling does not guarantee performance

Horizontal scaling adds servers rather than replacing one server with a larger machine. Sharding distributes data across servers; replication maintains copies. Multiple servers alone do not guarantee balanced data or faster queries. The MongoDB sharding overview describes distributed configurations separately.

A poorly distributed key can concentrate requests on a hot partition. For example, grouping every event under one fixed key can work against load distribution. Consider access patterns and key distribution together, as explained in DynamoDB’s partition-key guidance.

Performance depends on data size, indexes, query range, read/write mix, consistency settings and workload. Compare slow-request latency, failures and recovery behavior alongside average response time. Include replicas, backups, networking and operational work in the cost assessment; the NoSQL category alone does not establish a lower cost.

When should you consider NoSQL?

  • Known-key cache or session access: consider a key-value store while defining expiry, persistence and synchronization with authoritative data.
  • Catalog items with varying attributes: consider documents while designing shared-field validation and search indexes.
  • Events queried by a known key and period: consider wide-column storage while checking partition size and range queries.
  • Multi-step relationship traversal: consider a graph while defining connection types and traversal depth.

When varied reports join multiple tables or cross-record constraints need centralized enforcement, a relational database deserves an early comparison. Do not decide from an industry label or data volume alone: examine how the most important reads and updates would work in each candidate.

You can assign different roles to different stores, such as using a relational database as the authoritative source and a key-value store as a cache. Extra stores also make copy updates, deletion propagation and recovery more complex, so add them for a demonstrated requirement.

A practical evaluation sequence

  1. Write down the important queries. Specify filters and ordering for tasks such as product lookup by ID, recent user orders or a device’s daily records.
  2. Define correctness requirements. Record changes that must succeed together, duplicate-request handling, immediate reads and acceptable stale values.
  3. Design actual candidate models. Examine document size, embedding or references, indexes, partition keys and query paths as data grows.
  4. Compare small implementations. Use the same data and operations to reproduce normal load, concentrated load and failures; record product versions and settings.
  5. Plan operation and migration. Check permissions, backup and restoration, monitoring, migration, expected cost and a route back to the existing store if necessary.

Start with the queries and correctness requirements, then choose a model and product that satisfy them. If the database you already use meets those requirements, establish the reason for adding another kind of store before introducing it.

More in This Category
What Is NoSQL? Data Models, SQL Differences and When to Use It

What Is NoSQL? Data Models, SQL Differences and When to Use It

Understand the four main NoSQL data models and compare them with relational databases. Learn how schema design, transactions, consistency and distribution affect the decision to adopt a NoSQL product.

File Hashes: MD5, SHA-1, SHA-256 and How to Verify Downloads

File Hashes: MD5, SHA-1, SHA-256 and How to Verify Downloads

Learn how file hashes work, compare MD5, SHA-1, and SHA-256, and verify downloads with practical commands. Understand trusted reference checksums, mismatches, and why password storage needs a different hashing method.

What Is MongoDB? Features, Document Modeling and When to Use It

What Is MongoDB? Features, Document Modeling and When to Use It

Learn how MongoDB documents, validation, indexes and transactions work. A product example and modeling comparison explain use cases, replication versus sharding, and the operational checks needed before adoption.

JRE vs JDK: Differences, JVM and Which Java Package to Install

JRE vs JDK: Differences, JVM and Which Java Package to Install

Compare Java runtime and development packages, understand the JVM’s role, and choose the right installation. Includes modern packaging changes, executable checks, compilation examples and common launch errors.

What Is React? Key Concepts and Differences from jQuery

What Is React? Key Concepts and Differences from jQuery

Understand components, JSX, props, and state, then compare how React and jQuery update a page. Run equivalent counter examples and learn which approach fits your project.

EditPlus: How to Connect to a Remote Server Using FTP or SFTP

Learn how to configure FTP or SFTP accounts in EditPlus, open remote files and verify that saved changes reach the server. The guide covers protocol and port selection, authentication, directory browsing and common connection or permission errors.