title: DynamoDB partition key choice for notes app
body: <p>I want to create a DynamoDB table that allows me to save notes from users.</p>
  
  <p>The attributes I have:</p>
  
  <ul>
  <li>user_id</li>
  <li>note_id (uuid)</li>
  <li>type</li>
  <li>text</li>
  </ul>
  
  <p>The main queries I will need:</p>
  
  <ul>
  <li>Get all notes of a certain user</li>
  <li>Get a specific note</li>
  <li>Get all notes of a certain type (the less used query)</li>
  </ul>
  
  <p>I know that in terms of performance and DynamoDB partitions note_id would be the right choice because they are unique and would be distributed equally over the partitions but on the other hand is much harder to get all notes of a user without scanning all items or using a GSI. And if they are unique I suppose it doesn't make any sense to have a sort key.</p>
  
  <p>The other option would be to use user_id as partition key and note_id as sort key, but if I have certain users that are a much larger number of notes than others wouldn't that impact my performance?</p>
  
  <p>Is it better to have a partition key unique (like note_id) to scale well with DynamoDB partitions and use GSIs to create my queries or to use instead a partition key for my main query (user_id)?</p>
  
  <p>Thanks</p>