问题描述
根据规范,UUID为128位或16字节。十六进制表示形式是36个字符,包括连字符。我正在DynamoDB上构建一个新表,我必须确定计划用UUID填充的哈希键的类型。是否应该使用这些UUID的字符串或二进制散列键创建表?我的肠子告诉我字节,因为它的大小小于一半,所以节省了带宽,空间等。
A UUID is, according to the specification, 128 bits or 16 bytes. The hexadecimal representation is 36 characters including the hyphens. I'm building a new table on DynamoDB and I have to decide the Type for the Hash key which I plan on filling with UUIDs. Should I create the table with a Hash key that is a String or Binary for these UUIDs? My gut tells me byte, because its less than half the size so that saves bandwidth, space, etc.
有人能体验一种或另一种方式,并且感觉很好吗?为什么要一个使用另一个?
Does anybody have experience one way or the other and have a good reason to go with one over the other?
推荐答案
我个人更喜欢使用尽可能多的基于String的属性/键,主要是因为它
I personally prefer using as many String based attributes/keys as possible mainly because it is easier to debug those in the AWS DynamoDB console.
我还感到,二进制文件是为压缩和原始二进制数据添加的,而IMO UUID则不是。
I also feel that binaries were added for compressed and raw binary data which IMO UUIDs are not.
从纯粹的性能角度来看,您可能是正确的-但我会坚持使用可读的UUID字符串表示形式。
From a pure performance view, you are probably right - but I would stick with readable UUID String representations.
这篇关于DynamoDB中的UUID数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!