MySQL Store Image BLOB Bad Practice

I know that storing images as BLOBs in SQL is not recommended. However, working on my local PC and server makes it difficult to synchronize images between them. Still there will be a reason not to use BLOB only as a backup that would create a cached file locally (to statically set)?

In fact, is this performance only when choosing a BLOB column? If the only effect is a larger table, then I see no reason not to associate the image directly with the table entry.

+5
source share
1 answer

If you can make your images publicly available, I would recommend saving the images in a different (and probably cheaper) storage than your database, for example, S3.

But if your images should be private storing them in the database, this is not the worst option, but you need to process them in your code.

If you use the mysql5.6 and Barracuda formats (this is most common these days), then from the MySQL point of view, to store BLOB columns on a disk, you need to store 2 data instead of two, and the BLOB and TEXT columns are stored on the main data page.

You can learn more about this Percona Blog Entry

+1
source

Source: https://habr.com/ru/post/1233648/


All Articles