Take the 2-minute tour ×

Possible Duplicate:
what are the best tips for storing images in a database?

In those study cases of image storage,

  • An image that change only once in a while, if it changes at all (like an image for an article)
  • The image case from above is not only one image but over 10, that link to the same article
  • An image that have changes very often (like a banner image for a website)
  • The image above is huge

What is the best approach for each case? What is the "right/faster" way to do this task in each scenario ?

share|improve this question

marked as duplicate by Jarrod Roberson, Walter, GlenH7, Thomas Owens Dec 10 '12 at 18:51


Also Related: dba.stackexchange.com/questions/2445/… –  maple_shaft Dec 10 '12 at 19:01
@maple_shaft Excellent link, thank you. Answered my question =) –  Michel Ayres Dec 10 '12 at 19:14

2 Answers 2

up vote 2 down vote accepted

Sorry to provide a link only answer, but this microsoft research paper goes into great detail on the advantages of file system vs database for file storage:

To BLOB or Not To BLOB

share|improve this answer
How much has storage changed over the last 7 years? –  Wyatt Barnett Dec 10 '12 at 19:44

My default answer to the default image storage question is to do both -- store the original in the database, but use caching to serve it out of the filesystem. It gives you all the advantages of the database -- that is transactional updates, easier backup management and transportability as you can just deploy from the database while also preserving the filesystem's advantages of speed of serving static content.

share|improve this answer
Hmm nice idea, the problem is the cost in server and database. In small projects, I think, this is the best idea. +1 –  Michel Ayres Dec 10 '12 at 17:44
