title: How to choose a partition key in DynamoDB for a chat app
body: <p>I have a requirement to use DynamoDB for a chat app that will be used occasionally, on an event day. The app will be reading/writing few thousands of messages on a particular day, and almost none after that.</p>
  
  <p>Here's what I have in mind:</p>
  
  <pre><code>Table: Messages
  HashKey: Event day name
  SortKey: Message timestamp
  </code></pre>
  
  <p>I can get recent 20 messages (chat app usually get latest data only, no?), but the all read/write will be directed to one partition only.</p>
  
  <p>I could try this way</p>
  
  <pre><code>Table: EventDayMessage
  HashKey: Message timestamp
  </code></pre>
  
  <p>With this, the read/write will be spread out to the more recent message, but I have no way to get the recent messages due to no sort key.</p>
  
  <p>Is method 2 better in my scenario? What can I use for the sort key? Is there any other better suggestions (other than switching db)?</p>