DynamoDB 中的项目大小 [英] ItemSize in DynamoDB

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

问题描述

我正在尝试计算 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 的大小?沿着?双?它会占用与 100 或 1000000 相同的空间量还是只占用相应二进制文件的大小?

Does it mean that if I put a number in the database, example: 1 it'll take the size of an int? a long? a double? Will it take the same amount of space than 100 or 1000000 or it'll take only the size of the corresponding binary?

String 的计算是什么?

And what is the computing for String?

有人知道如何计算吗?

谢谢

推荐答案

这确实是一个不平凡的话题 - 您已经引用了 Amazon DynamoDB 数据模型:

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

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

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

这在 Amazon DynamoDB 数据类型 一点:

  • 字符串 - 字符串是带有 UTF8 二进制编码的 Unicode.
  • 数字 - 数字是正数或负数的精确值小数和整数.一个数字在小数点后最多可以有 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>) 而 来自 Stefano@AWS 的回答 提供了更多信息关于这个问题:

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 位精度这些是实际的十进制数字.所以它可以表示相当大的数字,并且没有精度损失.
  • Number 值占用多少空间? 不会太多很多.我们的内部表示是可变长度的,所以大小是与值中的实际(与最大)位数相关.顺便说一下,前导零和尾随零被修剪.[强调我的]
  • 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.

虽然亚马逊 尚未通过 API 公开其计费数据,但他们希望添加一个选项来检索某些时候向 DynamoDB API 提供一些有关项目大小的信息,正如 Christopher 所建议的那样.

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 中的项目大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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