title: How can I get the total number of items in a DynamoDB table?
body: <p>I want to know how many items are in my dynamodb table. From the API guide, one way to do it is using a <a href="http://docs.amazonwebservices.com/amazondynamodb/latest/developerguide/LowLevelPHPScanning.html" rel="noreferrer">scan</a> as follows:</p>
  
  <pre><code>&lt;?php
  $dynamodb = new AmazonDynamoDB();
  
  $scan_response = $dynamodb-&gt;scan(array(
      'TableName' =&gt; 'ProductCatalog' 
  ));
  
  echo "Total number of items: ".count($scan_response-&gt;body-&gt;Items)."\n";
  </code></pre>
  
  <p>However, this has to fetch all items and store them in an array in memory which isn't feasible in most cases I would presume. Is there a way to get the total item count more efficiently?</p>
  
  <p>This data is not available in the AWS Dynamo web-console, I have already checked. (at first it looks like it is shown alongside the pagination buttons, but it turns out the figure grows as you go to the next page of items).</p>