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

StackOverflow https://stackoverflow.com/questions/21550304

  •  06-10-2022
  •  | 
  •  

Вопрос

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 ?

Это было полезно?

Решение 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.

Другие советы

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top