扫描计数返回显着少于dynamodb表的数字(scan count returns significantly less number for a dynamodb table)

编程入门 行业动态 更新时间:2024-10-05 17:17:15
扫描计数返回显着少于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);

更多推荐

本文发布于:2023-07-09 10:24:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1085614.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数字   count   scan   dynamodb   number

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!