Java – the scan count returns a number significantly less than the dynamodb table

I'm running a sample Java program to query the dynamodb table, which has about 90000 items, but when I get the scan count from Java, it only displays 1994 items

ScanRequest scanRequest = new ScanRequest().withTableName(tableName);
 ScanResult result = client.scan(scanRequest);
 System.out.println("#items:" + result.getScannedCount());

The plan outputs #items: 1994, but the details of Amazon AWS console show:

Number of items *: 89249

Any ideas? thank you

Solution

Set the book object with the correct hash key value and get the count using dynamodb mapper

DynamoDBQueryExpression<Book> queryExpression = new DynamoDBQueryExpression<Book>()
                .withHashKeyValues(book);
dynamoDbMapper.count(Book.class,queryExpression);
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>