在查询/扫描 DynamoDB 时限制属性是否有意义?
Does it make sense to limit attributes when query / scan DynamoDB?
我的问题是在对 dynamoDB 进行查询/扫描时限制 returned 属性是否有意义。
我直接从 Lambda 进行查询,一次获取大约 100 条记录。之后,我 return 使用 API 网关将数据发送到 UI。我真的不需要所有属性,所以我的问题是 - 限制它们是否有意义? IE。而不是得到:
{a,b,c,d,e,f,g}
我只会要求
{a,b,c}
我会通过限制传输/请求/returned 数据的大小来节省资金,还是我只会减少响应大小?
不,您不会通过仅投影几个属性而不是整个项目来节省资金,也不会通过过滤掉整个项目(使用 FilterExpression)来节省任何资金。正如你所说,你会 "only reduce response size".
这是 DynamoDB 文档中的相关引用,https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
DynamoDB calculates the number of read capacity units consumed based on item size, not on the amount of data that is returned to an application. The number of capacity units consumed will be the same whether you request all of the attributes (the default behavior) or just some of them (using a projection expression). The number will also be the same whether or not you use a FilterExpression.
我的问题是在对 dynamoDB 进行查询/扫描时限制 returned 属性是否有意义。
我直接从 Lambda 进行查询,一次获取大约 100 条记录。之后,我 return 使用 API 网关将数据发送到 UI。我真的不需要所有属性,所以我的问题是 - 限制它们是否有意义? IE。而不是得到:
{a,b,c,d,e,f,g}
我只会要求
{a,b,c}
我会通过限制传输/请求/returned 数据的大小来节省资金,还是我只会减少响应大小?
不,您不会通过仅投影几个属性而不是整个项目来节省资金,也不会通过过滤掉整个项目(使用 FilterExpression)来节省任何资金。正如你所说,你会 "only reduce response size".
这是 DynamoDB 文档中的相关引用,https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
DynamoDB calculates the number of read capacity units consumed based on item size, not on the amount of data that is returned to an application. The number of capacity units consumed will be the same whether you request all of the attributes (the default behavior) or just some of them (using a projection expression). The number will also be the same whether or not you use a FilterExpression.