Store files in Database

  • we’ve stored files on a filesystem rather than in a database. I am expecting maybe a dozen files a month varying in size the highest would be ~5 MB. would filesystem or database is the better option for these files? Based on my research i read there are advantages storing on database for e.g. Fast query access, expandability, flexibility and scalability. Do you agree with me?

  • There are pros and cons for either option.

    If you're storing the files primarily for archival purposes, I would not put them into a database ... why bother?

    If you have other uses lined up, that may affect your choice.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • To add to what Phil said, I think it also depends on what files you are storing in the database.  Are they plain text or are they PDF and ZIP files?  You will lose a lot of the benefits of storing them in SQL if they are things like ZIP files.

    My preference is to use the filesystem to store files and the database to store data.  If the data in the files should be in a database, I'd use a different tool (SSIS for example) to pull the file data into the database for use.  This becomes more and more difficult if the source files don't have a nice consistent format to work with.

    But that is just me.  Others may disagree with that.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

Viewing 3 posts - 1 through 2 (of 2 total)

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