Your shard key determines data distribution and query efficiency:
Good shard keys have:
- High cardinality (many unique values)
- Even distribution (no hot spots)
- Query alignment (queries include the key)
Examples:
- user_id: Good for user-centric apps
- timestamp: Bad alone (hot spot on recent data)
- compound key (tenant_id, timestamp): Better distribution
Anti-patterns:
- Low cardinality keys (status, country)
- Monotonically increasing keys without hashing
- Keys not used in queries
Test your shard key with production-like data before deploying.