扫描计数返回显着少于dynamodb表的数字(scan count returns significantly less number for a dynamodb table)
我正在运行一个示例java程序来查询dynamodb表,该表有大约90000项,但是当我从java获得扫描计数时它只显示1994项
ScanRequest scanRequest = new ScanRequest().withTableName(tableName); ScanResult result = client.scan(scanRequest); System.out.println("#items:" + result.getScannedCount());该程序输出#items:1994但来自amazon aws控制台的详细信息显示:
项目数*:89249
任何想法? 谢谢
I'm running a sample java program to query a dynamodb table, the table has about 90000 items but when i get the scan count from java it shows only 1994 items
ScanRequest scanRequest = new ScanRequest().withTableName(tableName); ScanResult result = client.scan(scanRequest); System.out.println("#items:" + result.getScannedCount());the program outputs #items:1994 but the detail from amazon aws console shows:
Item Count*: 89249
any idea? thanks
最满意答案
使用正确的哈希键值设置book对象,并使用DynamoDBMapper获取计数。
DynamoDBQueryExpression<Book> queryExpression = new DynamoDBQueryExpression<Book>() .withHashKeyValues(book); dynamoDbMapper.count(Book.class, queryExpression);Set your book object with correct hash key value, and use DynamoDBMapper to get the count.
DynamoDBQueryExpression<Book> queryExpression = new DynamoDBQueryExpression<Book>() .withHashKeyValues(book); dynamoDbMapper.count(Book.class, queryExpression);更多推荐
发布评论