views:

58

answers:

3

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.

+2  A: 

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!

Time Machine
hi, thx for your quick answer!you strengthened my tendency to choose the DB :)is there ANY point that recommends the 1st solution?
poeschlorn
Well, MySQL requires software to be installed. XML libraries like libxml can simply be linked to your program. I'm not a Java expert so I don't know if Java supports XML by default.
Time Machine
@Koning WWWWWWWWWWWWWWWWWWWWWWW , you know that you can edit your profile and change your 'Display Name' at any time (possibly removing a few of the extra 'W's).
KM
@Koningsure, thats a point.In my case mysql and the api are already installed and ready to use ;-)what else? *brainstorming*
poeschlorn
@KM I cannot change it until June
Time Machine
+2  A: 

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.

Benoit
A: 

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?

poeschlorn