简体   繁体   English

DynamoDB慢速扫描查询

[英]DynamoDB slow scan query

When I do this query in AWS console it returns immediately: 当我在AWS控制台中执行此查询时,它立即返回:

在此处输入图片说明

But from the Java code, it never completes: 但是从Java代码来看,它永远不会完成:

    final List<TransactionDetails> tx = dynamoDBMapper //
            .scan(TransactionDetails.class, new DynamoDBScanExpression() //
                    .withConsistentRead(false)
                    .withLimit(maxRecords) //
                    .withFilterConditionEntry("time", new Condition().withComparisonOperator(ComparisonOperator.LT)
                            .withAttributeValueList(new AttributeValue(Long.toString(time)))));

    return tx;  

The DynamoDB console only shows 100 results at a time. DynamoDB控制台一次仅显示100个结果。 The DynamoDB mapper implements the scan operation such that it will automatically iterate over all the items in your table. DynamoDB映射器实现了扫描操作,因此它将自动遍历表中的所有项目。 It will make as many requests to Dynamo as it takes to scan the whole table, and it will also retry if it gets throttled. 它将向Dynamo发出与扫描整个表一样多的请求,并且在受到限制时也会重试。

For small tables, a scan usually completes in a few seconds, but a larger table, especially if you don't have enough provisioned read capacity, could take minutes, hours, or days.. 对于较小的表,扫描通常在几秒钟内完成,但是对于较大的表(尤其是如果您没有足够的预配置读取容量),扫描可能需要几分钟,几小时或几天的时间。

So - check the size of your table and the provisioned capacity. 因此-检查表的大小和预配置的容量。 The scan will complete but how long it takes definitely depends on these two variables. 扫描将完成,但是确定要花多长时间取决于这两个变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM