DynamoDB中的ItemSize [英] ItemSize in DynamoDB

查看:189
本文介绍了DynamoDB中的ItemSize的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在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 ?

谢谢

推荐答案

这确实是一个不重要的话题-您已经从 Amazon DynamoDB数据模型引用了一些草率的定义:

That's a non trivial topic indeed - You already quoted the somewhat sloppy definition from the Amazon DynamoDB Data Model:


项目大小是其属性名称的长度和值
(二进制和UTF-8长度)之和。 / p>

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

这在 Amazon DynamoDB数据类型


  • 字符串-字符串是采用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.

Amazon DynamoDB论坛(请参见数字类型的好奇性质)和答案进一步阐明了这一问题:

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:



  • 数字类型具有38位精度,这是实际的十进制
    位。因此它可以表示相当大的数字,并且没有
    精度损失。

  • 数字值占用多少空间?不是
    多。 我们的内部表示形式是可变长度,因此大小为
    ,与值中的实际(相对于最大)位数相关。
    前导和尾随零被修剪。 [强调我的]

  • 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)的后续帖子提供了更多有关存储消耗及其计算结果的见解。 :

Christopher Smith's follow up post presents more insights into the resulting ramifications regarding storage consumption and its calculation, he concludes:


现有的API很少提供有关存储
消耗的见解,即使这是其中的一部分(公认的不是
有效)。唯一的信息是
表的总大小,甚至该数据也可能不同步数小时。

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.

Amazon <一个href = https://stackoverflow.com/a/8931023/45773>尚未通过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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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