Search code examples
mysqlfilesqldatatypes

[mysql]What is the best data type to use to store small files in database <150kb


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 ?


Solution

  • 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.