Hey! 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? Like, will it take longer for the images to load and perhaps slow download the database? Appreciate the help!
views:
65answers:
3Of 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.
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.
Look at these questions (I know copying links is cheap, but in this case there exists so good answers to duplicate questions):
http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay#3756
http://stackoverflow.com/questions/8952/storing-a-file-in-a-database-as-opposed-to-the-file-system