{
  "id": "nosql",
  "title": "NoSQL",
  "lang": "en",
  "source_lang": "en",
  "summary": "NoSQL denotes diverse database systems that use nonrelational data models, often emphasizing flexible representation, distributed operation, and workload-specific performance.",
  "category": "computer-science",
  "subcategory": "software",
  "type": "concept",
  "aliases": [
    "NoSQL databases",
    "nonrelational databases",
    "non-SQL databases",
    "not-only-SQL databases"
  ],
  "generated_at": "2026-11-03",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/nosql/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/nosql/",
      "json": "https://aiwiki.page/zh/nosql.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "NoSQL is a broad designation for database management systems that do not primarily organize and manipulate data through the relational model. Its principal families include key–value stores, document databases, wide-column stores, and graph databases. These systems differ substantially in their query languages, transaction guarantees, storage engines, and deployment architectures. NoSQL is therefore an umbrella term rather than a single technical standard or a uniform alternative to SQL.\n\nThe modern NoSQL movement gained prominence in the late 2000s as large online services sought ways to distribute rapidly growing datasets and request volumes across many machines. Flexible records, predictable access paths, and tolerance of component failures became important design goals. However, nonrelational data models predate that movement, and neither distributed operation nor flexible schemas are exclusive to NoSQL.\n\nNoSQL systems matter because different representations of data make different operations efficient. A key-based lookup, a document retrieval, and a traversal through a network of relationships pose different engineering problems. Understanding NoSQL consequently requires examining data models alongside partitioning, consistency, transaction scope, storage organization, and operational requirements—not simply contrasting systems that accept SQL with systems that do not."
    },
    {
      "heading": "Origins and development",
      "text": "Nonrelational databases existed long before the name NoSQL became associated with large-scale web infrastructure. Hierarchical and network databases were established approaches before the relational database model, introduced by Edgar F. Codd in 1970, became commercially dominant. Persistent key–value libraries, object databases, and specialized graph systems also developed independently of the later NoSQL movement. Their existence makes it misleading to describe NoSQL as the invention of databases without tables.\n\nThe term has two distinct historical contexts. In 1998, Carlo Strozzi used “NoSQL” for a relational database system that did not expose an SQL interface. That usage concerned the query interface rather than rejection of the relational model. The name was revived for a different purpose around a 2009 meeting organized by Johan Oskarsson, with Eric Evans proposing it as a convenient label for discussions of emerging nonrelational systems. “Not only SQL” subsequently became a common interpretation, emphasizing coexistence rather than wholesale replacement.\n\nTwo influential publications helped establish the technical concerns associated with the movement. Google published its Bigtable paper in 2006, describing a distributed storage system for structured data organized as a sparse, distributed, persistent multidimensional sorted map. Amazon published the Dynamo paper in 2007, describing a highly available key–value store designed for services in which rejecting writes could be particularly costly. Bigtable emphasized ordered data organization and scalable storage; Dynamo highlighted partitioning, replication, versioning, and application-assisted conflict resolution. The original Dynamo system should not be confused with Amazon DynamoDB, a later managed database service.\n\nThese designs influenced a wider ecosystem. Apache HBase followed the Bigtable family of ideas, while Apache Cassandra combined aspects of Dynamo-style distribution with a wide-column data model. Document-oriented systems such as MongoDB and Apache CouchDB emphasized records containing nested structures. Redis made in-memory data structures available through a network service, while Neo4j popularized a property-graph approach. These products did not share one architecture, but they offered alternatives to conventional relational deployment and modeling practices.\n\nThe growth of cloud computing, open-source software, and large Internet services helped disseminate these systems. Their adoption also exposed the costs of distributed operation: application-visible consistency choices, duplicated data, partition-key design, and more demanding failure handling. NoSQL developed less as a replacement doctrine than as an expansion of the database design space, with systems optimized for particular access patterns and operational constraints."
    },
    {
      "heading": "Principal data models",
      "text": "A key–value store associates a unique key with a value and typically provides operations such as retrieval, insertion, replacement, and deletion. In the simplest form, the database treats the value as opaque: it can locate an object by key but cannot efficiently answer arbitrary questions about fields inside it. A session service, for example, might retrieve a serialized session using its identifier. More elaborate systems expose operations on typed values. Redis supports structures including hashes, lists, sets, and sorted sets, so its capabilities extend beyond storing uninterpreted byte sequences.\n\nA document database stores self-contained records, commonly using JSON or a binary representation with additional types. A customer document might contain an address object and an array of contact methods. Different documents can contain different fields, although systems may enforce validation rules. Unlike a basic key–value store, a document database commonly supports indexes and predicates over internal fields. MongoDB uses BSON, a binary document format that includes types such as dates and binary data. Apache CouchDB combines JSON documents with a replication-oriented design. The document boundary often influences atomic update scope and the placement of related information.\n\nWide-column stores organize data around row or partition keys and families of columns. “Wide-column” does not mean the same thing as column-oriented analytical storage. Bigtable identifies a value through a row key, column key, and timestamp; columns are grouped into families, and rows are ordered by key. Cassandra exposes tables through its Cassandra Query Language, but access efficiency depends strongly on partition keys and clustering columns. A table containing sensor measurements might partition by device and time bucket, then order measurements within each partition by timestamp. Although such a table resembles a relational table syntactically, it does not imply support for arbitrary joins or equivalent query planning.\n\nA graph database makes relationships explicit. In a property graph, nodes and edges can carry labels or properties, and edges connect particular nodes. Queries may follow relationships such as customer–account–transaction or person–employment–organization. Some implementations maintain direct adjacency structures that make local traversals efficient. Resource Description Framework stores use a different model based on subject–predicate–object statements and often support SPARQL. Property graphs and RDF stores therefore belong to a broad graph-oriented family without being interchangeable representations.\n\nThese categories overlap, and their boundaries are not standardized. A single engine may expose documents, graph operations, text search, and key-based access. Time-series databases and vector databases are sometimes grouped with NoSQL, but these terms identify workload specializations rather than one underlying data model. Vector similarity search, for example, can be provided by a dedicated service, a document database, or a relational extension. Classification is most useful when it identifies the actual unit of storage, supported operations, and indexing behavior rather than relying on product labels."
    },
    {
      "heading": "Partitioning, replication, and distributed architecture",
      "text": "Many NoSQL systems distribute data across machines using sharding, also called horizontal partitioning. Each partition holds a subset of records, usually determined by a key. Hash partitioning applies a hash function to spread keys across a logical space; range partitioning assigns contiguous intervals of ordered keys to partitions. Hashing can distribute diverse keys relatively evenly, whereas ranges can preserve locality for ordered scans. Neither method automatically distributes workload evenly: a single exceptionally popular key can remain a bottleneck even when record counts are balanced.\n\nA partition key is consequently both a logical identifier and a resource-allocation decision. If all events from one large customer share a key, that customer may dominate one partition. If every event receives an unrelated random key, time-range retrieval may require querying many partitions. Composite keys and time buckets can balance these concerns, but the correct layout depends on access patterns. Some systems split oversized ranges automatically; others place stricter responsibility on schema design. Rebalancing moves data when capacity changes, consuming network bandwidth and storage input/output while normal traffic continues.\n\nReplication places copies of data on multiple nodes. A leader-based design routes writes through an elected leader, which propagates changes to followers. Leaderless designs may accept writes through several replicas and reconcile their states later. Multi-leader designs allow independent write authorities, often across regions. These categories describe broad coordination patterns rather than guarantees by themselves: a leader-based system can expose stale follower reads, while a system accepting operations at multiple replicas can still coordinate particular requests strongly.\n\nReplication and partitioning solve different problems. Partitioning increases the amount of data or traffic a cluster can accommodate; replication provides additional copies for fault tolerance and sometimes read capacity. A database can use either technique without the other. Placement policy also matters. Three replicas on machines sharing one power supply do not provide the same protection as replicas distributed across independent failure domains. Replication across geographically distant data centers improves geographic resilience but introduces longer communication delays and more complicated failover decisions.\n\nDistributed control mechanisms determine which nodes own partitions, which leaders are authorized, and how configuration changes occur. Consensus algorithms such as Paxos and Raft can establish agreement despite some node failures, commonly by requiring a majority of a defined replica group. Other mechanisms, including gossip protocols, disseminate membership information without providing the same agreement guarantees. Routing may be handled by clients, proxy services, or coordinating nodes. These architectural choices shape behavior during failures as much as the public data model does: an identical document operation can have very different latency and failure semantics in two different systems."
    },
    {
      "heading": "Consistency, availability, and transactions",
      "text": "Consistency describes what a client may observe when operations occur concurrently or replicas disagree. It is not a single on–off property. Linearizability requires operations to appear to take effect atomically in an order consistent with real time. Eventual consistency requires replicas to converge if updates cease and propagation continues under the system’s assumptions, but it does not by itself specify what intermediate reads return. Causal consistency preserves ordering relationships such as a reply following the message it answers. Session guarantees, including read-your-writes and monotonic reads, can constrain the behavior observed by an individual client.\n\nThe CAP theorem, conjectured by Eric Brewer in 2000 and formalized by Seth Gilbert and Nancy Lynch in 2002, concerns a specific impossibility in an asynchronous distributed setting. During a network partition, a system cannot guarantee both linearizable behavior and availability, where availability means every request received by a nonfailing node eventually receives a response. The familiar phrase “choose any two” obscures the point: network partitions are not simply a feature that an operating system can elect to remove. The choice concerns how requests are handled when communication fails. CAP availability also differs from an operational uptime percentage.\n\nReplica quorums illustrate both the usefulness and limits of simple rules. If a record has \\(N\\) replicas, a write waits for \\(W\\) acknowledgments, and a read contacts \\(R\\) replicas, then\n\n\\[R + W > N\\]\n\nensures intersection between the selected read and write sets when they belong to the same fixed replica group. Intersection alone does not establish linearizability. Concurrent writes, version selection, failed operations, changing membership, and whether a successful read repairs older replicas all affect correctness. “Sloppy quorums,” which temporarily use substitute nodes, require additional care because the intended intersection may not hold.\n\nTransactions introduce a related but distinct set of properties. ACID denotes atomicity, consistency, isolation, and durability. Here, consistency refers to preservation of database invariants under appropriate transactions, not the replica consistency considered by CAP. Atomicity means a transaction’s changes take effect together or not at all; isolation constrains interference between concurrent transactions. Serializable isolation makes concurrent execution equivalent to some serial ordering. A claim of “transaction support” therefore needs a stated scope and isolation level: atomic replacement of one document is different from a serializable transaction spanning many partitions.\n\nNoSQL does not imply absence of transactions. MongoDB introduced multidocument transactions for replica sets in version 4.0 in 2018 and extended them to sharded clusters in version 4.2 in 2019. Other systems provide conditional writes, compare-and-set operations, or transactions over defined groups of records. Distributed transactions generally require additional coordination and may experience higher latency or reduced availability during failures. Applications that avoid them still need explicit methods for preserving invariants, such as reservations, deduplication keys, or compensating actions; removing a database transaction does not remove the underlying coordination problem."
    },
    {
      "heading": "Storage engines and physical organization",
      "text": "The external data model does not determine how bytes are arranged on storage. A document database and a wide-column store may both use similar underlying storage structures, while two key–value stores may have very different performance profiles. Storage engines coordinate memory, persistent files, indexes, logging, compression, and recovery. Their behavior depends on record size, access locality, update frequency, and the characteristics of the storage device. Consequently, “NoSQL performance” is not a meaningful property without a specified workload and implementation.\n\nA B-tree or a related B+ tree maintains ordered keys in a balanced hierarchy of pages. Searches descend through a small number of levels, and leaf ordering supports range scans. Updates may modify existing pages and cause page splits or merges, although modern engines employ varied buffering and copy-on-write techniques. B-tree-based structures remain useful for both relational and nonrelational databases because they support predictable point lookup and ordered traversal. Their practical cost depends heavily on caching, page layout, concurrency control, and whether access requires random storage reads.\n\nA log-structured merge-tree organizes updates differently. Writes commonly enter an in-memory structure and a recovery log, then are flushed into immutable sorted files. Background compaction merges files, removes obsolete versions when safe, and controls overlap. This design can transform many small random updates into larger sequential writes, but deferred maintenance introduces trade-offs. A read may need to consult several files; compaction rewrites data; and obsolete versions can occupy space until cleanup. These costs are described respectively as read, write, and space amplification.\n\nSupporting structures reduce these costs. Bloom filters can rule out many unnecessary file searches, allowing false positives but no false negatives for the represented set when correctly maintained. Block caches retain frequently accessed data, while compression reduces storage and transfer volume at the cost of processing work. Tombstones represent deletions until older versions can safely be discarded. In replicated systems, deleting tombstones too early can allow an old replica to reintroduce deleted data, so cleanup may depend on repair procedures and retention assumptions.\n\nDurability depends on the acknowledgment policy as well as the storage structure. A successful response might mean data is present only in memory, recorded in an operating-system buffer, forced to persistent media, or persisted on several replicas. These are different guarantees. File-system behavior, storage-device failure modes, and log synchronization affect recovery after a crash. In-memory systems can offer persistence through snapshots or append-only logs, but configuration determines the possible loss window. Replication likewise does not automatically make an acknowledged write durable if all acknowledged copies remain vulnerable to the same failure."
    },
    {
      "heading": "Data modeling, indexing, and query execution",
      "text": "NoSQL modeling commonly begins with the operations the application must perform. This contrasts with approaches that first construct a normalized representation and subsequently rely on a general-purpose query optimizer to combine relations. The difference is one of emphasis, not an absolute rule. A document database may support sophisticated aggregation, and a relational application may deliberately use denormalization. In both cases, efficient design depends on understanding which data must be retrieved together, which values change together, and which invariants must hold.\n\nEmbedding and referencing illustrate this process. An order document might embed the purchased items and their prices at the time of purchase. This permits retrieval of a historical order without reconstructing it from current product records. Embedding every order inside a customer document, however, can create an indefinitely growing object and concentrate unrelated updates on one record. Referencing separates lifecycles and reduces duplication but may require additional requests or server-side combination. Record-size limits, update contention, and transaction boundaries determine whether an apparently convenient document structure remains workable.\n\nWide-column modeling often makes access paths particularly explicit. A service might maintain one table organized by customer and time and another organized by shipment status and region. These tables duplicate selected facts so each query reaches a small, predictable set of partitions. The resulting challenge is maintenance: updating one representation but not another can produce inconsistent answers. Change events, asynchronous projections, or transactions can coordinate such updates, each with different failure and latency characteristics. This is a transfer of work from general-purpose query execution into schema design and update processing.\n\nIndexes allow predicates beyond primary-key lookup but introduce write and storage costs. A secondary index maps a field value to matching records. In a distributed system, an index may be local to each partition or organized globally under its own partitioning scheme. A local index can require contacting many partitions when the original partition key is unknown; a global index may require additional distributed updates. Compound indexes, array indexes, text indexes, and spatial indexes further shape which predicates can be executed efficiently. An index’s existence alone does not guarantee selectivity or bounded query cost.\n\nQuery interfaces vary from simple commands to declarative languages and aggregation pipelines. Cassandra Query Language resembles SQL but restricts many access patterns according to the primary-key layout. Graph systems offer traversal languages or pattern-matching languages, while document systems may expose expressions over nested fields. Applications communicate through drivers and application programming interfaces, but portable syntax is limited. An SQL-like interface does not make an engine relational, and the absence of SQL does not establish that it lacks joins, indexes, or transactions. Evaluation must distinguish the language accepted from the execution capabilities and guarantees behind it."
    },
    {
      "heading": "Operations, security, and performance measurement",
      "text": "Operating a distributed database requires observing more than whether individual processes are running. Important measures include replication lag, partition size, disk headroom, compaction backlog, repair progress, rejected requests, and latency distributions. A cluster can have healthy nodes yet return stale results or fail requests because a particular partition has lost its quorum. Maintenance tasks such as rebalancing, index creation, and data repair compete with foreground traffic. Capacity planning therefore has to include both ordinary service and the additional work generated by failures or topology changes.\n\nTimeouts create a particularly important application-level ambiguity. If a client sends a write and loses the response, the operation may have failed, succeeded, or still be in progress. Retrying a non-idempotent increment can apply it twice. Unique request identifiers, conditional operations, and deduplication records can make retries safer, but their retention and transaction scope matter. A driver retry policy is not equivalent to an end-to-end guarantee that a business action occurs exactly once. This problem appears in relational systems too, but distributed request routing and failover can make it especially visible.\n\nReplication is not a substitute for backup. An accidental deletion, application defect, or unauthorized modification may propagate to every replica. Recoverability requires independent restoration mechanisms, appropriate retention, and verification that data can actually be restored. A consistent backup across many partitions may require a coordinated snapshot or a combination of snapshots and logs. Point-in-time recovery reconstructs state up to a selected moment where supported. Recovery time and acceptable data loss are separate objectives: retaining every committed update does not establish how quickly a failed service can return.\n\nSecurity requirements include authentication, authorization, protected network communication, encryption at rest where appropriate, and auditing. Access controls may operate at the database, collection, table, key, or field level, depending on the system. Flexible query documents can create injection vulnerabilities if applications interpret untrusted structured input as query operators. Avoiding SQL syntax therefore does not eliminate injection risk. Publicly reachable endpoints, overly broad permissions, exposed administrative services, and insecure backup handling remain relevant regardless of data model. Data privacy obligations also extend to replicas, logs, indexes, and derived datasets.\n\nPerformance claims require reproducible workload definitions. The Yahoo! Cloud Serving Benchmark, introduced in 2010, provided a widely used framework for evaluating serving databases through operations such as reads, updates, inserts, and scans. Results depend on dataset size, read/write mix, key popularity, record size, cache state, client concurrency, and durability settings. Tail latency matters because a small fraction of slow operations can dominate user-visible delays, particularly when one request fans out to many partitions. Comparing a strongly consistent durable configuration with an asynchronous weakly durable one without identifying those differences produces a misleading ranking."
    },
    {
      "heading": "Workload fit and application patterns",
      "text": "Key–value systems are well suited to operations whose main question is “retrieve the state identified by this key.” Examples include user sessions, shopping-cart state, feature flags, and cached objects. A cache and a system of record nevertheless have different requirements. Cached data may be regenerated from another source, while losing authoritative cart or account state may be unacceptable. Eviction policy, expiry semantics, persistence, and replication must therefore be interpreted in the context of the data’s role, not merely the speed of key lookup.\n\nDocument databases fit applications where nested objects are a natural unit of access and where records evolve unevenly. Product catalogs may contain different attributes for books, clothing, and electronic components, while content systems may store documents with varied metadata. This flexibility reduces the need to place every optional field in one rigid structure, but it does not remove semantic constraints. Applications still require definitions of currency, timestamps, identifiers, and field meanings. A database can accept two incompatible representations of the same concept even when both are syntactically valid JSON.\n\nWide-column stores commonly support high-volume event histories, telemetry, and access patterns organized by entity and time. Their usefulness comes from predictable partition-local operations rather than unrestricted analysis of every field. A monitoring service might retrieve recent readings for one device or aggregate precomputed counters. Questions requiring arbitrary combinations across years of measurements may be better handled through separate analytical systems. Moving data into a data warehouse or processing it with tools such as Apache Spark introduces freshness, duplication, and governance concerns alongside analytical flexibility.\n\nGraph databases are useful when relationships themselves are central to the question. Examples include dependency analysis, network topology, knowledge graphs, and examination of connected entities in fraud detection. A traversal can follow successive relationships without repeatedly expressing each step as a conventional join. However, graph traversal is not inherently cheap. A node connected to millions of others, or a query that explores paths without strong restrictions, can generate enormous intermediate work. Partitioning a highly connected graph also creates communication costs when traversals cross machine boundaries.\n\nOther workloads expose the limits of broad product categories. Full-text retrieval depends on tokenization, ranking, and inverted indexes, while similarity retrieval for machine learning often depends on approximate nearest-neighbor indexes. Time-series analysis may require compression, retention policies, and time-window aggregation. Some NoSQL products integrate these facilities; others rely on dedicated systems. Combining specialized stores can improve workload fit, but it creates multiple authoritative or derived representations. The engineering problem then includes synchronization and ownership of data, not just choosing a fast engine for each isolated operation."
    },
    {
      "heading": "Convergence with relational and cloud-native systems",
      "text": "The early contrast between flexible, distributed NoSQL and rigid, centralized relational databases has become increasingly inaccurate. Relational engines can store JSON, index nested attributes, partition tables, and replicate across machines. NoSQL systems have added validation, richer query languages, secondary indexes, and distributed transactions. These developments do not erase architectural differences, but they weaken classifications based on a short feature checklist. The relevant question is often how a capability is implemented and what it costs, rather than whether a product claims to possess it.\n\nNewSQL and distributed SQL systems pursue relational interfaces and transactional guarantees while distributing data and computation. Their existence demonstrates that horizontal scaling does not logically require abandoning relations or SQL. Conversely, a single-node embedded key–value engine remains nonrelational without being a distributed database. Data model, execution architecture, consistency model, deployment model, and commercial packaging are distinct dimensions. Treating them independently makes comparisons more precise and avoids assigning properties to a system merely because it belongs to a named market category.\n\nManaged cloud services change operational responsibilities without eliminating database trade-offs. Providers may automate replication, patching, backup scheduling, capacity allocation, and failover. Pricing can be based on provisioned throughput, consumed operations, storage, data transfer, or combinations of these. An access pattern that is technically possible may still be expensive if it scans large volumes or repeatedly crosses regions. Automatic scaling also has limits determined by partition structure, service quotas, scaling response time, and the presence of unusually hot records.\n\nMultimodel systems seek to reduce the need for separate stores by exposing several representations through one platform. A database may support documents and graphs over related underlying data or combine transactional access with search and analytics. Such integration can reduce synchronization work, but the apparent unity of the interface does not ensure that every feature shares identical freshness, isolation, or recovery semantics. A search index updated asynchronously from transactional data, for example, may temporarily omit a newly committed record even though both are presented as parts of the same product.\n\nThe continuing research and engineering problems concern efficient coordination, predictable latency, geographic distribution, and control of duplicated state. Stronger guarantees generally require communication or restrictions that become visible under contention and failure. Weaker guarantees shift some responsibility to application logic and conflict handling. Workload-specific systems remain valuable where those choices can be made explicitly, while increasingly capable general-purpose databases reduce the number of applications that require a specialized store. Precise descriptions consequently identify supported operations, transaction boundaries, failure behavior, and resource costs rather than relying on the NoSQL label alone."
    }
  ],
  "links": [
    "database-management-system",
    "sql",
    "relational-database",
    "google",
    "redis",
    "cloud-computing",
    "open-source-software",
    "internet",
    "sharding",
    "database-replication",
    "data-center",
    "cap-theorem",
    "acid",
    "b-tree",
    "log-structured-merge-tree",
    "file-system",
    "denormalization",
    "application-programming-interface",
    "data-backup",
    "authentication",
    "encryption",
    "data-privacy",
    "data-warehouse",
    "apache-spark",
    "knowledge-graph",
    "information-retrieval",
    "machine-learning"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}