Classic question: does it make sense to store files in a database?
Classic answer: no.
Pragmatic answer: it depends.
For the SQL Server and MySQL data providers I’m writing for ScrewTurn Wiki, I decided to store files directly in the database, for the following reasons:
- if you are using a database for the rest of the data, it makes sense to store everyting in it so you simplify backups and management
- storing everything in the database (including providers’ DLLs!) and disabling the cache (or using an appropriate cache provider), you can scale ScrewTurn Wiki using a server farm (not tested yet, but it should work)
- given that users most likely upload files via the browser, they won’t likely upload files bigger than a few megabytes – the providers, anyway, limit the file size to 50 MB
- a big file upload will hit ASP.NET maxRequestLength limit before the database limit
I have no idea whatsoever about the throughput to and from the database, I’ll have to do some tests when the providers will be complete (in a few hours, probably).
On a side note, I’m using varbinary(max) for SQL Server and blob for MySQL, thus requiring SQL Server 2005/2008 and MySQL 5.