问题描述
我正在尝试在dynamoDB中计算项目的大小,但我无法理解其定义。
I'm trying to compute the size of an item in dynamoDB and I'm not able to understand the definition.
我发现的定义:项目大小是其属性名称和值的长度之和(二进制和UTF-8长度)。因此,如果您将属性名称保持简短,将很有帮助。
这是否意味着如果我在数据库中输入数字,例如:1它将使用一个int的大小?长吗?一双?
Does it means that if I put a number in the database, example: 1 it'll takes the size of an int ? a long ? a double ? Will it takes the same amount of space than 100 or 1000000 or it'll takes only the size of the corresponding binary ?
String的计算量是多少?
And what is the computing for String ?
p>
有人知道如何计算吗?
Is there someone that know how to compute it ?
谢谢
推荐答案
这确实是一个不重要的话题-您已经从引用了一些草率的定义:
That's a non trivial topic indeed - You already quoted the somewhat sloppy definition from the Amazon DynamoDB Data Model:
这在:
- 字符串-字符串是采用UTF8二进制编码的Unicode。
- Number -数字是正数还是负数,值小数和整数。小数点后的数字精度最高为38位,并且可以在10 ^ -128到10 ^ + 126之间。 Amazon DynamoDB中的表示形式具有可变长度。删除前导零和尾随零。
- String - Strings are Unicode with UTF8 binary encoding.
- Number - Numbers are positive or negative exact-value decimals and integers. A number can have up to 38 digits of precision after the decimal point, and can be between 10^-128 to 10^+126. The representation in Amazon DynamoDB is of variable length. Leading and trailing zeroes are trimmed.
在(请参见)和进一步阐明了这一问题:
A similar question than yours has been asked in the Amazon DynamoDB forum as well (see Curious nature of the "Number" type) and the answer from Stefano@AWS sheds more light on the issue:
提供了更多有关存储消耗及其计算结果的见解。 :
Christopher Smith's follow up post presents more insights into the resulting ramifications regarding storage consumption and its calculation, he concludes:
Amazon 尚未通过API公开其结算数据,他们希望他们会添加一个选项来检索有关商品尺寸的一些信息,正如克里斯托弗(Christopher)所建议的那样,在某些时候使用了DynamoDB API。
While Amazon does not expose it's billing data via an API yet, they they'll hopefully add an option to retrieve some information regarding item size to the DynamoDB API at some point, as suggested by Christopher.
这篇关于DynamoDB中的ItemSize的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!