binary data in database, blob vs compressed base64

前端 未结 1 668
猫巷女王i
猫巷女王i 2021-01-01 17:53

There is a column type named blob in database, and it is used to store binary data.

But more often than not, I see solutions which compress binary data, then convert

1条回答
  •  有刺的猬
    2021-01-01 18:16

    It seems that I have to answer my own question. Most of the time, storing compressed base64 into database is not a good idea. It is more complex than storing blob. And most of the time binary is smaller than base64 string.

    I only find one case that compressed base64 is useful: you can't alter the table schema, and there are only text columns, thus you have to store binary data into that table. The only possible way is to convert binary to base64 string.

    0 讨论(0)
提交回复
热议问题