How can I get the total number of items in a DynamoDB table?

前端 未结 8 2041
南旧
南旧 2020-12-05 23:33

I want to know how many items are in my dynamodb table. From the API guide, one way to do it is using a scan as follows:



        
8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-06 00:04

    Please do not use scan method of dynamoDb because it read all data of tabel but in this case u need only count so use this .

    $scan_response = $dynamodb->describeTable(array(
    'TableName' => 'ProductCatalog' ));
    

    and print this for result $scan_response['Table']['ItemCount']

提交回复
热议问题