带有“限制”的DynamoDB SCAN操作成本参数 [英] DynamoDB SCAN operation cost with "Limit" parameter

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

问题描述

我对AWS DynamoDB还是陌生的,并且已经阅读了文档,但我不确定100%确定在 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不会影响扫描整个表的成本,但是会过滤整个扫描后 以及返回的扫描项总数是否超过最大数据集大小限制的返回值

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 '参数是否为1 MB一种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(为了获得最近的10个活动)执行SCAN,显然我会取回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.

推荐答案

是的,限制也会减少消耗的读取容量,这是 DynamoDB文档

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


扫描操作提供了一个Limit参数,您可以使用该参数来设置请求的页面大小。页面大小较小的每个扫描或查询请求都使用较少的读取操作,并在每个请求之间创建暂停。例如,如果每个项目为4 KB,并且您将页面大小设置为40个项目,则查询请求将仅消耗40个高度一致的读取操作或20个最终一致的读取操作。大量较小的扫描或查询操作将使您的其他关键请求成功而无节制。

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天全站免登陆