views:

60

answers:

3

What are the problems associated with storing your Data in files rather than databases? I'm thinking in terms of something like a blog engiene. I read that MoveableType used to do this. What are the pros/cons of working this way?

A: 

I think the main one is data consistency. If you keep everything together in one db table, you don't have to worry (as much) about the file being externally modified or deleted without the meta data being modified in sync. There's also the possibility of an incomplete write if the server fails while you're updating. In this case you have to take your own steps to implement transactions.

I think that with an appropriate level of care and file permissions though, these problems can be overcome.

Dana the Sane
+1  A: 

Databases provide means to perform interesting queries more easily.

Examples: You would want to list the 10 most recent posts on the front page. Make an archive page that lists all articles published in a given year (taken from the url).

Christian
A: 
  1. It is much easier and more comfortable to specify access rights (to data or file) in database than to use OS specific access rights.

  2. You can easily share data across machines and/or websites using database-stored files.

  3. Unfortunately, it is (often) much slower to serve files stored in database.

Jiri