Azure Cosmos DB
activeby Microsoft · since 2017 · also known as Cosmos DB, CosmosDB, Azure DocumentDB (legacy name)
Microsoft's globally distributed, multi-API NoSQL and vector database with SLA-backed latency.
Overview
Azure Cosmos DB is a fully managed, horizontally partitioned NoSQL service with turnkey multi-region writes, five well-defined consistency levels and a 99.999% availability SLA for multi-region accounts. The native API for NoSQL queries JSON with a SQL dialect, and other APIs expose MongoDB (RU-based), Cassandra, Gremlin and Table semantics on the same backend. It has leaned hard into AI workloads with DiskANN-based vector search, full-text and hybrid search, and it powers ChatGPT's chat history at OpenAI. Billing is in request units, which rewards careful partition-key and indexing design and punishes careless queries.
Strengths & trade-offs
Strengths
- +Multi-region writes with automatic failover and a 99.999% SLA
- +Five consistency levels let you trade latency against guarantees per request
- +Automatic indexing of every property by default
- +DiskANN vector search plus full-text and hybrid search next to operational data
- +Change feed and Fabric mirroring for event-driven and no-ETL analytics
- +Serverless and autoscale throughput modes
Trade-offs
- −Request-unit pricing is hard to forecast; cross-partition queries get expensive
- −Transactions are limited to a single logical partition
- −No joins across documents in the NoSQL API
- −The MongoDB (RU) and other compatibility APIs lag their originals
- −Azure-only
Great for
- +Globally distributed user and session data
- +IoT telemetry and device state
- +Chat history and memory for AI agents
- +Retail carts, catalogs and personalization
- +Gaming leaderboards and player profiles
Think twice for
- −Highly relational apps (use Azure SQL or PostgreSQL)
- −Analytical workloads (use Fabric or a warehouse)
- −Teams wanting predictable flat-rate pricing
Capabilities
Native or official first-party support · 15 of 25 tracked
Scale & consistency
- Comfortable data size
- Massive · Multi-PB
- Horizontal scaling
- Native
- Multi-region
- Active active
- Transactions
- Limited ACID
- Consistency
- Tunable, Strong, Causal, Eventual
- Schema
- Schemaless
- Architecture
- Distributed, Multi primary, Serverless
- Query languages
- Cosmos DB NoSQL (SQL dialect), MongoDB Query API, CQL, Gremlin
Automatic partitioning by partition key (with hierarchical keys); any number of Azure regions with multi-region writes.
Deployment
available on · Azure
Ecosystem
Alternatives to Azure Cosmos DB
AWS's serverless key-value and document store with single-digit-millisecond reads at any scale.
azure-cosmos-db vs amazon-dynamodb →Microsoft's managed MongoDB-compatible service, built on the open-source DocumentDB engine.
azure-cosmos-db vs azure-documentdb →MongoDB's own multi-cloud DBaaS, bundling search, vector search and stream processing.
azure-cosmos-db vs mongodb-atlas →Serverless document database with realtime listeners, offline SDKs and a new Enterprise edition.
azure-cosmos-db vs google-cloud-firestore →Google's globally consistent, horizontally scaling SQL service with graph, vector and full-text built in.
azure-cosmos-db vs google-cloud-spanner →Couchbase's managed DBaaS: Couchbase Server clusters plus App Services sync and AI tooling.
azure-cosmos-db vs couchbase-capella →Azure Cosmos DB FAQ
What is Azure Cosmos DB?
Azure Cosmos DB is a document database by Microsoft, first released in 2017. Azure Cosmos DB is a fully managed, horizontally partitioned NoSQL service with turnkey multi-region writes, five well-defined consistency levels and a 99.999% availability SLA for multi-region accounts. The native API for NoSQL queries JSON with a SQL dialect, and other APIs expose MongoDB (RU-based), Cassandra, Gremlin and Table semantics on the same backend. It has leaned hard into AI workloads with DiskANN-based vector search, full-text and hybrid search, and it powers ChatGPT's chat history at OpenAI. Billing is in request units, which rewards careful partition-key and indexing design and punishes careless queries.
Is Azure Cosmos DB open source?
No. Azure Cosmos DB is proprietary, closed-source software.
Does Azure Cosmos DB support ACID transactions?
Partly. Azure Cosmos DB offers limited ACID guarantees (for example, single-record or single-partition transactions), with tunable, strong, causal, eventual consistency.
Does Azure Cosmos DB scale horizontally?
Azure Cosmos DB scales horizontally out of the box, with built-in sharding or partitioning. It is comfortable at massive scale (Multi-PB). It supports active-active multi-region writes.
How can I run Azure Cosmos DB?
You can use the vendor's managed cloud and run it serverless. It is available on Azure.
What is Azure Cosmos DB best for?
Azure Cosmos DB is a strong fit for globally distributed user and session data; IoT telemetry and device state; and chat history and memory for AI agents. Think twice for highly relational apps (use Azure SQL or PostgreSQL).
What are the best alternatives to Azure Cosmos DB?
Common alternatives to Azure Cosmos DB include Amazon DynamoDB, Azure DocumentDB, MongoDB Atlas, Google Cloud Firestore and Google Cloud Spanner. The right choice depends on your workload, scale and hosting; WhichDB's smart match ranks them against your requirements.
How popular is Azure Cosmos DB?
Azure Cosmos DB ranks #39 of 844 databases on the WhichDB Score (45.3/100), and #4 among document databases. The score combines public adoption signals such as package downloads, GitHub activity, job posts and developer discussion.