爲什麼hbase的value都是使用字節數組byte[]來存儲

這是原文,上面的答案翻譯

https://stackoverflow.com/questions/11834544/why-hbase-stores-value-as-byte-array-instead-of-typed-value-like-string-long

不能看的同學可以看一下原文回答

it allows us to store any kind of data without much fuss. For example, imagine you have to store a product related data into your hbase table, say ID, make, country, price etc. To store each of these parameters you would have to take care of the individual datatypes of each of these parameters in advance which will definitely add some overhead. And unlike RDBMSs, hbase doesn't ask for all this at the time of table creation. So, even if datatypes of these parameters change tomorrow or you decide to add some parameters(with some new datatype), all you have to do is wrap the value in Bytes.ToBytes() and push it into your table. All this makes insertions faster.  Also, sometimes storing a value in a serialized byte[] form saves a few bytes as compared to storing the same values in their native format. And this minor saving becomes quite significant when you deal with BigData.  Long story short, Hbase does this to make things faster and to make storage more efficient, keeping the overhead of internal data structures to a minimum

 

谷歌翻譯:

它允許我們毫不費力地存儲任何類型的數據。例如,假設您必須將產品相關數據存儲到您的hbase表中,例如ID,品牌,國家/地區,價格等。要存儲這些參數中的每一個,您必須提前處理每個參數的各個數據類型。這肯定會增加一些開銷。與RDBMS不同,hbase在創建表時不會要求所有這些。因此,即使這些參數的數據類型明天發生變化,或者您決定添加一些參數(使用一些新的數據類型),您所要做的就是將值包裝在Bytes.ToBytes()中並將其推送到表中。所有這些使得插入更快。此外,與以原始格式存儲相同值相比,有時以序列化byte []形式存儲值可節省幾個字節。當你處理BigData時,這種輕微的節省變得非常重要。簡而言之,Hbase這樣做可以使事情變得更快,並使存儲更加高效,從而將內部數據結構的開銷降至最低

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章