Store images in database or webserver?

  • What's the pros and cons of storing images in a db versus storing them in a folder on a webserver? In the latter method, the image paths will be stored in the db to reference the images in the folder.

  • I believe that the general consensus in the group is that the best practice is to store the images in a file system and the paths to the images, along with any reference data, in the database.  The usual justification is that this lets the database do what it does best, which has not traditionally been the efficient storage and retrieval of blobs, and reduces complexity.

    I am of the contrarian opinion, however.  I have worked with systems which have done it both ways, and the grief I had trying to keep the database and the file system in sync when one or the other needed to be recovered/restored, or the flakey application updated one but not the other, was worse than the grief I would have endured to ensure that the database and server were tuned to quickly server the images.

    Just my opinion.  Your milage may vary.


    And then again, I might be wrong ...
    David Webb

  • The only thing I would like to add is that if you are going to store blobs in the database, you might want to store them on a seperate filegroup by using the TEXTIMAGE_ON option.

     


    I feel the need - the need for speed

    CK Bhatia

  • I agree with the in-database approach - neater and more robust ... but put the images in a dedicated table with just id and, assuming its big, put it in its own file group on a separate drive.

  • It depends on the size of the drives on the server and if you are the hosting company or if you are buying the hosting.

    Many companies limit the size of the databases. But the file space is much larger.

    There is not a single answer for your question. It depends on the situation.

    Personally, I use file system only. But that is just me.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply