简体   繁体   中英

Store binary strings mysql

I am trying to figure out what the best way is to save binary data displayed as a string of 0s and 1s in mysql. The data has varies lengths and must be suitable to store up to 60000 bytes.

As varbinary can also store strings of characters i am confused how the data is stored and if i might need a translation beforehand to improve the space of the database. The same counts for a blob. So what is the most efficient way to safe binary data in the form of zeros and ones?

Store data as Integer type may be better. And do transform task (decimal to binary and binary to decimal) in backend layer.

In my experience BLOB will do the job for you. You can do better also if you embrace the string with COMPRESS('') mysql function before (obviusly this must be decompressed with DECOMPRESS() when you read).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM