Start With the Queries, Not the Container

While a container is small and sits in one physical partition, almost any design works and the bill stays low. That's the time to get the partition key right, because it's the one decision you can't change later without copying the container. List your main queries first, then choose the key.

Most Cosmos DB problems arrive as a 429 error or a surprising invoice, and most of them trace back to one early decision: the partition key. Pick one that concentrates traffic and you get throttling no matter how many Request Units you buy. Pick one your queries do not use and every read fans out across every partition.

Cosmos DB hides replication, consensus and global distribution behind Request Units per second, and it is very good at that. What it cannot hide is how your data is split. Below are the concepts that decide cost and speed (partition keys, point reads, consistency levels) and the newer features, such as vector search in the NoSQL API, that are worth knowing about.

Signs your Cosmos DB design needs another look
  • You picked id as your partition key and now every query not by id fans out
  • You don't know the difference between Strong, Bounded Staleness, Session, Consistent Prefix, and Eventual
  • You're scared to read your RU bill
  • You're using SQL API but issuing cross-partition queries on every request