How do you pick a partition key in Cosmos DB?
IntermediateConceptDatabases (Azure SQL, Cosmos DB, PostgreSQL)
Answer
Pick a property with high cardinality that spreads requests and storage evenly and appears in most queries, such as tenantId or userId. A bad key creates hot partitions and cross-partition queries that waste RUs. The partition key cannot be changed without migrating data.