Domanda

I am asked to store small files in a mysql database. They are limited to 150kb.

What data type is the most efficient to use? BINARY(150000), VARBINARY(150000) or MEDIUMBLOB ?

È stato utile?

Soluzione 2

Ok I got my answer so I share it here: since we finally wanted to use the column to store short texts (value of the message can be an embedded file or some text), I used mediumblob that consists of text. And any way on the web, I found references to blob rather than to binary types.

FYI the file is encoded in binary Base64 format.

Altri suggerimenti

Have you considered storing your files in a file system and in the database maybe storing only metadata such as relative path ? I think thats the right way

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top