title: Improving Dynamo DB response time
body: <p>I have the following Dynamo DB table structure:</p>
  
  <ul>
  <li>item_type (string)  --> <strong>Partition Key</strong></li>
  <li>item_id (number) --> <strong>Secondary Index</strong></li>
  </ul>
  
  <p>The table has around 5 million records and auto scaling is enabled with default read capacity of 5. I need to fetch the item_id given certain item type. We have around 500000 item_types and each item type will be associated with multiple item ids. I see a response of around 4 seconds for popular item_types. I am testing this on AWS Lambda, I start the timer when we make the query and end it once we get the response. Both Lambda and Dynamo DB are in the same region.</p>
  
  <p>This is the query I am using:</p>
  
  <pre><code>response = items_table.query(
      KeyConditionExpression=Key('item_type').eq(search_term),
      ProjectionExpression='item_id'
  )
  </code></pre>
  
  <p>Following are some of the observations:</p>
  
  <ul>
  <li>It takes more time to fetch popular items</li>
  <li>As the number of records increase, the response time increases</li>
  </ul>
  
  <p>I have tried Dynamo DB Cache but the Python SDK is not up to the mark and it has certain limitations.</p>
  
  <p>Given these details following are the questions:</p>
  
  <ul>
  <li>Why is the response time so high? Is it because I am querying on a string not a number.</li>
  <li>Increasing the read capacity also did not help but why?</li>
  <li>Is there any other aws service which is faster than Dynamo DB for such type of queries. </li>
  </ul>
  
  <p>I have seen seminars where they claim to get sub millisecond response times on billions of records with multiple users accessing the table. Any pointers towards achieving sub second response time will be helpful. Thanks.</p>