具有“限制"的 DynamoDB SCAN 操作成本范围 [英] DynamoDB SCAN operation cost with "Limit" parameter

查看:12
本文介绍了具有“限制"的 DynamoDB SCAN 操作成本范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 AWS DynamoDB 的新手,阅读了文档后,我不确定在 SCAN 中使用Limit"参数时成本计算会发生什么情况

I'm pretty new to AWS DynamoDB and having read the documentation I'm not 100% sure what happens to cost calculations when using the 'Limit' parameter in a SCAN operation.

我知道应该设计表格,以便主要使用 QUERY 操作,并且 SCAN 将扫描整个表格,从而消耗大量读取容量.我也了解 FilterExpression 不会影响扫描整个表的成本,但会过滤返回的内容 整个扫描,如果扫描项目的总数超过最大数据集大小限制1 MB,扫描停止并返回结果.

I understand that one should design the tables so that QUERY operations are predominantly used and that a SCAN will scan the entire table, thus consuming a lot of read capacity. I also understand that a FilterExpression doesn't affect that cost of scanning the entire table, but filters what is returned after the entire scan, and if the total number of scanned items exceeds the maximum data set size limit of 1 MB, the scan stops and results are returned.

我不确定的是,'Limit' 参数是否是一种 FilterExpression,或者它是否会停止整个扫描,从而降低读取成本.

What I'm not sure of, is whether the 'Limit' parameter is a type of FilterExpression, or whether it stops an entire scan, thus reducing read costs.

例如,如果我有一个活动表,其排序键是日期字段 (updatedAt),并且它有一百万行.如果我使用 Limit = 10 执行 SCAN(以获取最新的 10 个活动),我显然会返回 10 行,但我会为读取一百万行而付费吗?成本是我最关心的问题.

For example, if I had an activity table with a sort key that is a date field (updatedAt) and it had a million rows. If I performed a SCAN with a Limit = 10 (in order to get the very latest 10 activities), I would obviously get back 10 rows but would I be charged for reading a million rows? Cost is my main concern.

推荐答案

是的,Limit 也会减少消耗的读取容量,这里是DynamoDB 文档:

Yes, Limit will also rediuce the consumed read capacity, here is the relevant part from the DynamoDB docs:

Scan 操作提供了一个 Limit 参数,您可以使用该参数为您的请求设置页面大小.每个具有较小页面大小的扫描或查询请求使用较少的读取操作并在每个请求之间创建一个暂停".例如,如果每个项目为 4 KB,并且您将页面大小设置为 40 个项目,则查询请求将仅消耗 40 次强一致性读取操作或 20 次最终一致性读取操作.大量较小的 Scan 或 Query 操作将允许您的其他关键请求成功,而不会受到限制.

The Scan operation provides a Limit parameter that you can use to set the page size for your request. Each Scan or Query request that has a smaller page size uses fewer read operations and creates a "pause" between each request. For example, if each item is 4 KB and you set the page size to 40 items, then a Query request would consume only 40 strongly consistent read operations or 20 eventually consistent read operations. A larger number of smaller Scan or Query operations would allow your other critical requests to succeed without throttling.

如您所见,每个页面尺寸较小的扫描或查询请求使用较少的读取操作.

这篇关于具有“限制"的 DynamoDB SCAN 操作成本范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆