Accoring to 3.x document , the blob type is suitable for storing a small image or short string.
In my case, I used it to store a hashed value, since the hash function returns a binary file, and the best option is to save it as a binary file from the data size representation of the table. (Converting to a string and saving as a string (text) may also be fine if size is not considered.)
The results below show my test on the local computer (insert 1 million records), and the sizes are 52 626 907 (binary) and 72 879 839 (data with base64 conversion as a string). unit: byte.
CREATE TABLE IF NOT EXISTS testks.bin_data ( bin_data blob, PRIMARY KEY(bin_data) ); CREATE TABLE IF NOT EXISTS testks.base64_data ( base64_data text, PRIMARY KEY(base64_data) ); cqlsh> select * from testks.base64_data limit 10; base64_data ------------------------------ W0umEPMzL5O81v+tTZZPKZEWpkI= bGUzPm4zRvcqK1ogwTvPNPNImvk= Nsr0GKx6LjXaiZSwATU38Ffo7fA= A6lBV69DbFz/UFWbxolb+dlLcLc= R919DvcyqBUup+NrpRyRvzJD+/E= 63LEynDKE5RoEDd1M0VAnPPUtIg= FPkOW9+iPytFfhjdvoqAzbBfcXo= uHvtEpVIkKivS130djPO2f34WSM= fzEVf6a5zk/2UEIU8r8bZDHDuEg= fiV4iKgjuIjcAUmwGmNiy9Y8xzA= (10 rows) cqlsh> select * from testks.bin_data limit 10; bin_data -------------------------------------------- 0xb2af015062e9aba22be2ab0719ddd235a5c0710f 0xb1348fa7353e44a49a3363822457403761a02ba8 0x4b3ecfe764cbb0ba1e86965576d584e6e616b03e 0x4825ef7efb86bbfd8318fa0b0ac80eaa2ece9ced 0x37bdad7db721d040dcc0b399f6f81c7fd2b5cea6 0x3de4ca634e3a053a1b0ede56641396141a75c965 0x596ec12d9d9afeb5b1b0bb42e42ad01b84302811 0xbf51709a8d1a449e1eea09ef8a45bdd2f732e8ec 0x67dcb3b6e58d8a13fcdc6cf0b5c1e7f71b416df6 0x7e6537033037cc5c028bc7c03781882504bdbd65
hikutas simokawa
source share