Database · AZ-305
Database partition-skew simulation
Generate original synthetic records and show actual bucket counts for both constant and spread keys.
Run the local exercise
Key results
| Metric | Value | Unit |
|---|---|---|
| Constant-key max bucket share | 100% | |
| Spread-key max bucket share | 20% |
Toy hash bucket counts
| Metric | Value | Unit |
|---|---|---|
| b1 | Constant key count: 0; Spread key count: 24 | rows |
| b2 | Constant key count: 120; Spread key count: 16 | rows |
| b3 | Constant key count: 0; Spread key count: 18 | rows |
| b4 | Constant key count: 0; Spread key count: 20 | rows |
| b5 | Constant key count: 0; Spread key count: 24 | rows |
| b6 | Constant key count: 0; Spread key count: 18 | rows |
- This deterministic toy hash is not Cosmos DB physical placement, latency, or RU cost.
Experiment steps
- Choose integer record and bucket counts.
- Compare constant-key and spread-key counts per bucket plus max share.
- Review the result with query patterns, cross-partition reads, and transaction boundaries.
Sources, formula, and limitations
Original deterministic toy hash with synthetic records; compares per-bucket counts and maximum bucket share for a constant key versus spread keys.
Does not use Cosmos DB physical partitions, RU, latency, or real tenant data; only explains skew.
The toy hash does not represent Cosmos DB placement, latency, RU cost, or a complete partition-key recommendation.