|
You seem to be reading a lot into the term "database" that isn't there. Database access is not inherently faster or slower than file access; they are efficient for different kinds of operations. File systems are good at storing and retrieving variable-length streams of bytes, which might need to grow or shrink. Databases are good at storing and retrieving structured records, usually of fixed size. File systems and databases are often used in conjunction, with a database acting as an index of structured metadata for data stored in files (this is basically what a file system is in the first place, except that it only stores essential system information about files).
Again, it depends on what you're storing and what you want to do with it. Files let you read, overwrite, or append to a chunk of data quickly assuming you already know where it is. What's expensive is if you need to re-read the entire file every time you want to retrieve a record, or re-write most of the file every time you want to insert a record (mainstream operating systems have no "insert in middle of file" operation).
If performance and administration are major concerns, you may want to look into a lightweight in-process database such as Berkeley DB, cdb, gdbm, or dbm. |