title: Deciding primary key for DynamoDB
body: <p>I have 3 fields to store in DynamoDB: identity-1, identity-2, score.
  identity-1 and identity-2 are always unique in the table, i.e. no two entries can have same identity-1 or identity-2.</p>
  <p>We want to allow entries to either have one of identity-1 or identity-2 or have both. Example:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>identity-1</th>
  <th>identity-2</th>
  <th>score</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>a1</td>
  <td>b1</td>
  <td>s1</td>
  </tr>
  <tr>
  <td>a2</td>
  <td></td>
  <td>s2</td>
  </tr>
  <tr>
  <td></td>
  <td>b3</td>
  <td>s3</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Access patterns are as follows:</p>
  <ol>
  <li>Query identity-2 from identity-1</li>
  <li>Query score from identity-1</li>
  <li>Query score from identity-2</li>
  </ol>
  <p>How do I define primary key in such case?</p>