Reputation: 2180
Is it better to store the file in the database or just the path of the file in question?
And especially if the volume and the file numbers are important.
Upvotes: 3
Views: 139
Reputation: 27342
TL;DR
objects smaller than 256K are best stored in a database while objects larger than 1M are best stored in the filesystem
You need to decide what to do with objects between 256K and 1M.
Have a read of this Microsoft Research article - which explains this: To BLOB or Not To BLOB: Large Object Storage in a Database or a Filesystem
Notes:
There is actually no cut and dry solution to this, you may have reasons for doing one or the other.
For example in a highly security critical application you may decide to store everything in the db.
There are many factors to think about. If you need to replicate your db, it helps to have everything in the db, because you can be sure your replicated db can serve up all the files
If the application is performance critical you have a good reason to store everything on the filesystem (especially if the files are large and/or you are reading/writing them a lot)
Upvotes: 4