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

MetricValueUnit
Constant-key max bucket share100%
Spread-key max bucket share20%

Toy hash bucket counts

MetricValueUnit
b1Constant key count: 0; Spread key count: 24rows
b2Constant key count: 120; Spread key count: 16rows
b3Constant key count: 0; Spread key count: 18rows
b4Constant key count: 0; Spread key count: 20rows
b5Constant key count: 0; Spread key count: 24rows
b6Constant key count: 0; Spread key count: 18rows
  • This deterministic toy hash is not Cosmos DB physical placement, latency, or RU cost.
Toy hash bucket countsb10 rows24 rowsb2120 rows16 rowsb30 rows18 rowsb40 rows20 rowsb50 rows24 rowsb60 rows18 rows

Experiment steps

  1. Choose integer record and bucket counts.
  2. Compare constant-key and spread-key counts per bucket plus max share.
  3. 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.