Skip to content
CAMPUX
Field notes · Databases
Azure SQL vs Cosmos DB

Azure SQL vs Cosmos DB: relational or NoSQL for your app?

By 9 min read

Both are fully managed Azure databases, so the choice is not about who patches the servers — it is about the shape of your data and where in the world it needs to be. Get that right and the rest follows.

New to cloud? CAMPUX is a free, build-first course. Start here →

Azure SQL Database is the relational option: tables, a fixed schema, joins, and T-SQL transactions, scaled up inside a region. Azure Cosmos DB is the NoSQL option: schema-flexible JSON, scaled out by throughput, replicated to any Azure region with multi-region writes and single-digit-millisecond reads. Choose by the shape of your data, not by reputation.

When a project needs a database on Azure, two names lead the shortlist: Azure SQL Database and Azure Cosmos DB. Because both are fully managed — Azure handles patching, backups, and high availability for each — the decision is not "which saves me more operations." It is a design question about your data: is it relational, with a schema and relationships you query across, or does it need to scale out globally with the flexibility of a document model? That fork decides.

Azure SQL Database: managed relational

Microsoft describes it as "a fully managed platform as a service (PaaS) database engine that handles most of the database management functions such as upgrading, patching, backups, and monitoring without user involvement." It runs the SQL Server engine, so it is a relational database — tables, a schema, joins, transactions, and the full power of T-SQL. You get automatic backups with point-in-time restore, built-in high availability, and options like active geo-replication and zone-redundancy, all without managing a server. If your data has structure and relationships — orders linked to customers linked to invoices — and you want to query across them with SQL, this is home.

Azure SQL is relational and scales up; Cosmos DB is NoSQL, globally replicated, and scales out.Azure SQL — relationalfixed-schema tablesscale UPjoins · transactions · one bigger serverCosmos DB — NoSQL, globalflexible JSON docsreplicated worldwideregion 1region 2region 3
Figure — Azure SQL is a managed relational database: fixed-schema tables, joins, and ACID transactions, scaled mostly by making one server bigger (scale up). Cosmos DB is NoSQL built for global scale: schema-flexible JSON documents replicated across regions and scaled out by partitioning, so reads and writes happen near the user with single-digit-millisecond latency. Choose SQL for relational integrity; Cosmos for planet-scale, low-latency, flexible data.

Azure Cosmos DB: globally distributed NoSQL

Cosmos DB is a different philosophy. Microsoft calls it "a fully managed NoSQL and vector database" that "offers single-digit millisecond response times, automatic and instant scalability," with turnkey global distribution and multi-region writes backed by a 99.999% availability SLA for multi-region accounts. It is schema-flexible and multi-model — document, key-value, graph, table, and vector — and it scales horizontally by throughput (measured in request units). Where SQL Database gives you relational depth in a region, Cosmos DB gives you a database you can push to any Azure region with a button, serving reads and writes close to users worldwide at very low latency.

Azure SQL DatabaseAzure Cosmos DB
Data modelRelational (tables, schema)NoSQL, multi-model (document, key-value, graph…)
QueryT-SQL, joins, transactionsAPI for NoSQL and others; point reads & queries
ScaleScale up (vCore/DTU), serverless optionScale out by throughput, globally
Global reachGeo-replication / failover groupsTurnkey multi-region writes
ConsistencyStrong inside the database; geo-replicas read slightly behindFive levels to choose from: strong, bounded staleness, session, consistent prefix, eventual
TransactionsACID transactions across tablesAtomic batches inside one logical partition
Priced byvCore or DTU, plus a serverless tierRequest units — provisioned, autoscale, or serverless — plus storage
Best whenData is relational and structuredGlobal scale, flexible schema, low latency
Poor fitPlanet-scale, schema-flexible, multi-region writesHighly relational apps; analytics and reporting (OLAP)

Managed is a tie. The real question is the shape of your data — relational depth, or global reach with a flexible schema.

Microsoft's own steer

The Cosmos DB docs are refreshingly honest about where it is a poor fit: highly relational apps (they say to consider Azure SQL or Azure Database for MySQL) and heavy analytical/OLAP workloads. And the SQL Database docs point the other way for planet-scale, schema-flexible workloads. The two products are not really rivals fighting over the same job — they are answers to different questions, and each recommends the other for the wrong fit.

Is Cosmos DB SQL or NoSQL?

Cosmos DB is NoSQL. The reason so many people search for "cosmos db sql" is the naming: the native, default API is called Azure Cosmos DB for NoSQL, and its query language borrows SQL keywords. You write SELECT p.id, p.name FROM products p WHERE p.price > 20 against JSON documents. Microsoft describes that language as "a powerful, SQL-like syntax for working with JSON data." Older Microsoft articles and URLs still call the same thing the SQL API.

So "SQL" in Cosmos DB names the query dialect, not the engine. The differences that matter sit underneath the familiar keywords. There is no fixed schema, so a property can be missing on one document and present on the next. JOIN exists, but it unrolls arrays inside a single document — it does not join across containers the way a relational join crosses tables. Queries are charged in request units, and a query that does not carry the partition key fans out across every physical partition and costs more. Familiar syntax, different rules.

One more piece of the naming, because it changes the honest answer to "is Cosmos DB relational?": the brand now covers more than the document API. Azure Cosmos DB for PostgreSQL is a distributed relational offering sold under the same name, and Microsoft's Cosmos DB documentation landing page describes the service as a "fully managed, distributed NoSQL, relational, and vector database." The Cosmos DB most people mean — the API for NoSQL — is not relational. The brand as a whole is no longer only NoSQL.

Azure NoSQL databases: the wider list

Cosmos DB is the answer most people want when they search for an Azure NoSQL database, but it is a family of APIs rather than one product, and it is not the only NoSQL store on Azure. Here is the shortlist, with the model each one implements.

ServiceModelReach for it when
Azure Cosmos DB for NoSQLDocument (JSON)The default for a new app: global reach, flexible schema, millisecond reads
Azure Cosmos DB for MongoDBDocumentYou are carrying MongoDB drivers and tooling across
Azure Cosmos DB for Apache CassandraColumn-family (CQL)Existing Cassandra code, written in CQL
Azure Cosmos DB for Apache GremlinGraphThe questions you ask are about relationships and traversals
Azure Cosmos DB for TableKey-valueA Table storage app that now needs global distribution
Azure Table storageKey-valueCheap structured NoSQL inside a storage account, no global reach needed
Azure Managed Instance for Apache CassandraColumn-familyYou want real open-source Cassandra clusters, managed
Azure Managed RedisKey-value, in memoryCaching and session state, not a system of record

Two habits keep this straight. First, pick the model before the product: document, key-value, column-family, or graph. Second, pick a Cosmos DB API only for a reason you can say out loud — existing MongoDB or Cassandra code — because the API for NoSQL gets Cosmos DB features first. Cheap and simple has a home too: Azure Table storage is still the right answer for a small key-value table that never leaves one region, and the cheap Azure database options note walks the budget end.

Cosmos DB vs Blob Storage and Data Lake Storage

These land in the same search because all three hold data, but only one of them is a database. Blob Storage and Azure Data Lake Storage are object storage: they hold files — images, exports, Parquet, backups — and you read and write whole objects. Data Lake Storage is Blob Storage with a hierarchical namespace and HDFS compatibility added, which is what makes it the landing zone for analytics engines. Neither one gives you an indexed, millisecond lookup of a single record by id.

Cosmos DB is operational: the live state your application touches on every request, indexed automatically, read in single-digit milliseconds. So this is rarely a real choice. A working system uses both — raw and historical files in Data Lake Storage, live state in Cosmos DB or Azure SQL, and an analytics engine such as Microsoft Fabric reading across them. If the question is genuinely files against files, the Files versus Blob Storage note is the one you want.

How to choose

The mistake to avoid is picking by fashion — "NoSQL because it sounds modern" or "SQL because it is familiar." Pick by the data. If it is relational, a relational database will save you from re-implementing joins by hand; if it needs to live in five regions at once with a loose schema, a relational database will fight you the whole way. Say why you chose — "relational data with strong consistency needs, so Azure SQL" — and you sound like an engineer who designs rather than defaults.

Questions people also ask

What is the difference between Azure SQL Database and Cosmos DB?

Azure SQL Database is a relational engine: tables, a fixed schema, joins, and T-SQL transactions, scaled up within a region. Cosmos DB is a NoSQL, multi-model database with a flexible schema, scaled out by throughput across regions with turnkey multi-region writes and single-digit-millisecond reads. Both are fully managed by Azure.

Is Cosmos DB SQL or NoSQL?

Cosmos DB is NoSQL. The confusion comes from the name of its default API, Azure Cosmos DB for NoSQL, whose query language borrows SQL keywords such as SELECT, FROM and WHERE and runs them over JSON documents. Older Microsoft material calls that same API the SQL API. The dialect looks like SQL; the engine underneath is not relational.

What is Azure Cosmos DB for NoSQL?

It is the native, default API of Cosmos DB: JSON documents held in containers, indexed automatically, and queried with what Microsoft describes as a SQL-like syntax for working with JSON data. It is the API to pick for a new application unless you are carrying MongoDB, Cassandra, or Gremlin code across, because it gets Cosmos DB features first.

Is Cosmos DB a relational database?

The Cosmos DB most people mean, the API for NoSQL, is not relational. It stores schema-flexible JSON, and its JOIN keyword unrolls arrays inside one document rather than joining across containers. The brand is wider than that offering, though: Microsoft now describes Azure Cosmos DB as a distributed NoSQL, relational, and vector database, because Azure Cosmos DB for PostgreSQL is a distributed relational offering sold under the same name.

What are the NoSQL database options in Azure?

Azure Cosmos DB is the main one, and it carries several APIs: NoSQL for JSON documents, MongoDB, Apache Cassandra, Apache Gremlin for graphs, and Table for key-value data. Outside Cosmos DB there is Azure Table storage for cheap structured NoSQL inside a storage account, Azure Managed Instance for Apache Cassandra for open-source Cassandra clusters, and Azure Managed Redis for in-memory key-value work.

Is Cosmos DB better than SQL Database?

Neither is better in general — they solve different problems. Cosmos DB wins for global, high-scale, schema-flexible workloads with low-latency reads worldwide. Azure SQL Database wins when your data is relational, you need joins and transactions, and it lives comfortably in one or a few regions. Choose by data shape, not by reputation.

Can Cosmos DB replace SQL Server?

Not for highly relational applications. Microsoft's own Cosmos DB docs list highly relational apps as a poor fit and say to consider Azure SQL or Azure Database for MySQL instead. Cosmos DB has no cross-container joins and no fixed schema enforcement, so an app built around customers, orders, and invoices with strong relational integrity keeps its data in a relational engine.

When should you use Cosmos DB instead of Azure SQL Database?

Reach for Cosmos DB when users are global, scale is huge or spiky, the schema needs to stay flexible, and you need single-digit-millisecond reads in multiple regions at once — a worldwide product catalog, IoT device state, or a gaming leaderboard. For structured data with joins and transactions, stay with Azure SQL Database.

What is the difference between Azure Data Lake and Cosmos DB?

Data Lake Storage is object storage with a hierarchical namespace, built to hold large files for analytics. Cosmos DB is an operational database built for indexed reads and writes of single items in milliseconds. You put raw and historical files in Data Lake Storage and process them in batch; you put the live state your application reads on every request in Cosmos DB. Most real systems use both.

Further reading — the Microsoft docs
Your next class · free
You've read the idea. Class 37 — Azure Databases is where you build it, hands-on — no account needed.Start Class 37 →
Captain O
Founder & instructor · CAMPUX Cloud Engineering Bootcamp
LinkedIn
Drilled in Class 37 — Azure Databases. Back to all field notes →