On Tue, Jun 01, 2004 at 09:46:22AM +0900, Sven Schott wrote:
> I am writing a very simple web based file/asset manager. I was 
> initially thinking of simply creating a database with the info on each 
> file and keeping the files in the filesystem. However, I have begun to 
> wonder if having the files in a database would be faster(or slower). 
> Has anybody had any experience with this sort of thing? Would large 
> databases slow things down? Should I just keep stuff on the filesystem? 
> I have had some issues on the DB with encoding types. I probably 
> wouldn't want to base64 encode everything. ;)

No, you would want to store the file in a BLOB column of your database.
There are no encodings defined on BLOB columns.

To get your files out of the database, you need a CGI script (or
something equivalent), which is for sure slower that direct file access
(especially when written in Ruby). But that depends on what you prefer,
flexibilty or performance, and the size of your files. For many "small"
files, with attached meta-data I'd prefer a database over the file
system. 

For example, I stored the article images for an online shop inside a
postgres database. But I havn't measured the performance. But I can give
you hints how to write the CGI that gets the file out of the db. 

Regards,

  Michael