poeschlorn
poeschlorn

Reputation: 12440

General question: Filesystem or database?

I want to create a small document management system. There are several users who store their files. Each file which is uploaded contains info about which user uploaded it and the document content itself. In a view all files of ONE specific user will be displayed, ordered by date.

What would be better:

  1. giving the documents a name or metadata (XML) which contain the date and user (and iterate through them to get the metadata) or...

  2. giving the files a random/unique name and store metadata in a DB? something like this:

    date | user | filename
    

What would you say and why? The used programming language is Java and the DB is MySQL.

Upvotes: 1

Views: 575

Answers (3)

poeschlorn
poeschlorn

Reputation: 12440

So what would be, if the amount of data is very low, let's say max. 30 files per user, and let's say 20 users -> 600 files maximum. how would you judge the solution to create a seperate folder for each user and give the files an user reliant unique name? So you can navigate througth the file system easily. in this context, would a DB make sense for this low amount of documents?

Upvotes: 0

Benoit
Benoit

Reputation: 3598

I would choose the second option for metadata storing. MySQL will handle concurency, and searching in DB is much more faster than iterating an XML file.

Upvotes: 3

user142019
user142019

Reputation:

I would choose the DB. DB's are faster, safer (you don't by accident delete important files) and easier. Also, this is the purpose of a DB: managing large a mounts of data. Filesystems are for storing files.

But the choise is of course to you.

But I guarantee: (DB > XML) == true in performance, and (DB >= XML) == false in filesize!

Upvotes: 3

Related Questions