Seventy One Percent
You are picking one shard key for a messaging backend. This is the measured query mix:
| share of reads | query | predicate |
|---|---|---|
| 62% | last 50 messages of a conversation | conversation_id = ? order by sent_at desc |
| 24% | a recipient's unread count | recipient_id = ? and read_at IS NULL |
| 9% | search inside one conversation | conversation_id = ? and body match |
| 5% | nightly moderation sweep | sent_at between ? and ? |
Writes are one row per message. Which key should the table be hash-sharded on?
Sign in to answer questions and track your progress
Sign In