title: Should I always create my DynamoDB tables using hash and range primary key type?
body: <p>In the docs (<a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/APISummary.html" rel="noreferrer">http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/APISummary.html</a>) it states:</p>
  
  <blockquote>
    <p>You can query only tables whose primary key is of hash-and-range type</p>
  </blockquote>
  
  <p>and</p>
  
  <blockquote>
    <p>we recommend that you design your applications so that you can use the Query operation mostly, and use Scan only where appropriate </p>
  </blockquote>
  
  <p>It's not directly stated, but does this make it best practice to use hash-and-range primary keys?</p>
  
  <p>EDIT:</p>
  
  <p>Answer TL;DR: Use whichever primary key type that makes sense for your data model and use secondary indexes for better querying support.</p>
  
  <p>References:</p>
  
  <p><a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html" rel="noreferrer">http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html</a></p>
  
  <p><a href="http://www.allthingsdistributed.com/2013/12/dynamodb-global-secondary-indexes.html" rel="noreferrer">http://www.allthingsdistributed.com/2013/12/dynamodb-global-secondary-indexes.html</a></p>
  
  <p><a href="https://forums.aws.amazon.com/thread.jspa?messageID=604862" rel="noreferrer">https://forums.aws.amazon.com/thread.jspa?messageID=604862</a></p>
  
  <p><a href="https://stackoverflow.com/questions/28713369/in-what-situation-do-you-use-simple-hash-keys-on-dynamodb">In what situation do you use Simple Hash Keys on DynamoDB?</a></p>