Storing images in MySQL vs Filesystem
Is it better to save images uploaded by users into a MySQL database or to the filesystem? I figure its easier to manage the files if they are in the database, however the database will quickly grow in size due to the images. Although, if you save the images to the filesystem there might be issues of versioning the images and handling browser caching when users replace old images.
What do you guys typically do? I'm interested to hear arguments from both sides.
I prefer to store the images as files in the file system and only information about the images in the database (including data like file name and possibly directory name, if applicable, to use for <img> tags or otherwise accessing the file when needed). After all, you are (probably) never going to need to search the actual binary image data, so if you store it in the DB all you are doing is using a different means to save it to a file that requires additional overhead to access it.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread