gpt4 book ai didi

amazon-dynamodb - DynamoDB 中的项目大小

转载 作者:搜寻专家 更新时间:2023-11-01 03:50:36 24 4
gpt4 key购买 nike

我正在尝试计算 dynamoDB 中项目的大小,但我无法理解定义。

我找到的定义:项目大小是其属性名称和值的长度之和(二进制和 UTF-8 长度)。因此,保持属性名称简短会有所帮助。

这是否意味着如果我在数据库中放入一个数字,例如:1,它会占用一个 int 的大小?沿着?双?它会占用与 100 或 1000000 相同的空间量还是只占用相应二进制文件的大小?

String 的计算是什么?

有没有人知道如何计算它?

最佳答案

这确实是一个不平凡的话题 - 您已经引用了 Amazon DynamoDB Data Model 中有些草率的定义:

An item size is the sum of lengths of its attribute names and values (binary and UTF-8 lengths).

这在 Amazon DynamoDB Data Types 中的页面下方有详细说明。一点:

  • 字符串 - 字符串是采用 UTF8 二进制编码的 Unicode。
  • 数字 - 数字是正负精确值小数和整数。一个数字的小数点后最多可以有 38 位精度,可以在 10^-128 到 10^+126 之间。 Amazon DynamoDB 中的表示是可变长度的。删除前导零和尾随零。

Amazon DynamoDB forum 中提出了与您类似的问题以及(参见 Curious nature of the "Number" type )和 answer from Stefano@AWS更清楚地说明了这个问题:

  • The "Number" type has 38 digits of precision These are actual decimal digits. So it can represent pretty large numbers, and there is no precision loss.
  • How much space does a Number value take up? Not too much. Our internal representation is variable length, so the size is correlated to the actual (vs. maximum) number of digits in the value. Leading and trailing zeroes are trimmed btw. [emphasis mine]

Christopher Smith's follow up post他总结道:

The existing API provides very little insight in to storage consumption, even though that is part (admittedly not that significant) of the billing. The only information is the aggregate table size, and even that data is potentially hours out of sync.

虽然亚马逊does not expose it's billing data via an API yet ,他们希望在某个时候向 DynamoDB API 添加一个选项来检索有关项目大小的一些信息,正如 Christopher 所建议的那样。

关于amazon-dynamodb - DynamoDB 中的项目大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29757698/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com