Disadvantages of storing images in a Database? [cl

2019-02-25 10:28发布

Can anyone please tell me the disadvantages of storing images in a MySQL database?
Is it not as efficient as storing the images on the server? Will it take longer for the images to download vs disk storage and will it put heavy load on the database? Appreciate the help!

2条回答
别忘想泡老子
2楼-- · 2019-02-25 10:50

One advantage you get from storing images on the disk is that you can serve them directly with a fast web server (nginx), which doesn't have to hit your code at all. Another one is that you can easier switch to a CDN later if you have to.

查看更多
戒情不戒烟
3楼-- · 2019-02-25 10:57

Of course it might be a little slower than if you save them as files. Always depends how big and how many images you have.
We store the profile images in the DB and that works fine. It also makes the handling easier, because you don't have to worry about the file system and if you backup the DB, everything is backuped (is that a word?).

Assuming you are not facebook or flickr I would not worry about it.

查看更多
登录 后发表回答