DynamoDB 计算操作容量单位消耗
DynamoDB count operation capacity units consumption
如果我没记错的话,要执行项目计数,在 DynamoDB 中我们必须使用 query 操作并提供 Select: 'COUNT'
作为参数。让我们考虑一下,我想计算具有特定分区键的项目数。鉴于我们必须使用 query
操作,这是否意味着以下内容?:
- 即使我们只返回计数,消耗的读取
容量单位将对应于所有项目的大小
该分区键。
- 如果具有给定分区键的项目的大小超过
1MB,计数会偏,只会考虑最多的项目
1MB,操作将分页。
对于你的两个问题,答案都是肯定的。
从文档中的这两点可以看出这一点:
- Count 和 ScannedCount 的区别:
If you used a QueryFilter in the request, then Count is the number of items returned after the filter was applied, and ScannedCount is the number of matching items before the filter was applied.
If you did not use a filter in the request, then Count and ScannedCount are the same.
- DynamoDB 将 Count 视为可以返回的另一个属性这一事实:
You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.
如果我没记错的话,要执行项目计数,在 DynamoDB 中我们必须使用 query 操作并提供 Select: 'COUNT'
作为参数。让我们考虑一下,我想计算具有特定分区键的项目数。鉴于我们必须使用 query
操作,这是否意味着以下内容?:
- 即使我们只返回计数,消耗的读取 容量单位将对应于所有项目的大小 该分区键。
- 如果具有给定分区键的项目的大小超过 1MB,计数会偏,只会考虑最多的项目 1MB,操作将分页。
对于你的两个问题,答案都是肯定的。
从文档中的这两点可以看出这一点:
- Count 和 ScannedCount 的区别:
If you used a QueryFilter in the request, then Count is the number of items returned after the filter was applied, and ScannedCount is the number of matching items before the filter was applied.
If you did not use a filter in the request, then Count and ScannedCount are the same.
- DynamoDB 将 Count 视为可以返回的另一个属性这一事实:
You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.