我正在尝试使用Datastax Academy数据建模类(class)中的公式来计算具有任意数量的列和类型的表中每一行的分区大小。
为此,我需要了解一些常见的Cassandra数据类型的“字节大小”。我试图用谷歌搜索,但是我得到了很多建议,所以我很困惑。
我想知道字节大小的数据类型是:
当然,关于Cassandra中数据类型大小的任何其他考虑也应理解。
添加更多信息,因为似乎难以理解我只是在估计Cassandra在后台进行的任何压缩和其他优化而没有占用的任何压缩和其他优化的情况下,数据将占据的“最坏情况下的磁盘使用率”。
我正在遵循Datastax学院类(class)DS220(请参阅末尾的链接)并实现公式,并将此处答案中的信息用作该公式中的变量。
https://academy.datastax.com/courses/ds220-data-modeling/physical-partition-size
最佳答案
从务实的角度来看,我认为在设计时预先使用ds220类(class)中的公式对最坏情况进行估算是明智的。压缩的效果通常会根据数据中的算法和模式而有所不同。从ds220和http://cassandra.apache.org/doc/latest/cql/types.html:
uuid: 16 bytes
timeuuid: 16 bytes
timestamp: 8 bytes
bigint: 8 bytes
counter: 8 bytes
double: 8 bytes
time: 8 bytes
inet: 4 bytes (IPv4) or 16 bytes (IPV6)
date: 4 bytes
float: 4 bytes
int 4 bytes
smallint: 2 bytes
tinyint: 1 byte
boolean: 1 byte (hopefully.. no source for this)
ascii: equires an estimate of average # chars * 1 byte/char
text/varchar: requires an estimate of average # chars * (avg. # bytes/char for language)
map/list/set/blob: an estimate
希望能帮助到你
关于cassandra - 常见的Cassandra数据类型的字节大小是多少-在计算分区磁盘使用量时要使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40087926/