Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

This question already has an answer here:

While reading the advantages of RDBMS,over a file processing system(like NTFS,FAT 32),I had a question in mind: The popular operating systems(like Windows) continue to use file processing systems(like FAT,NTFS),inspite of its disadvantages.Why don't they use a RDBMS?

share|improve this question
1  
What exactly are the advantages of an RDBMS in this context? RDBMSs work well in a relational environment. Is a filesystem relational? –  tjameson May 14 '13 at 7:26
    
But could the RDBMS be used to express the filesystem data? –  user1369975 May 14 '13 at 8:27
1  
related (actually, an "inverted duplicate"): Why use a database instead of just saving your data to disk? A possible "direct" duplicate: Why is filesystem preferred for logs instead of RDBMS? –  gnat May 14 '13 at 8:37
add comment

marked as duplicate by Joris Timmermans, gnat, Jalayn, MichaelT, GlenH7 May 14 '13 at 14:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

Traditionally, file systems are hierarchical trees. Each directory has a 0-n other sub-directories these also have 0-n subdirectories, these too, and so on.

Relational databases aren't very good for expressing tree data structures, because it requires you to do an unknown amount of self-joins to traverse the tree.

It would of course be theoretically possible to design a filesystem which isn't a directory tree. I could imagine a filesystem without directories where every filename in the whole filesystem must be unique so it can be used as a primary key (that would be like having every single file of a system in the same directory), or where the primary key for each file is application, user, filename and revisionNumber (so you essentially have a fixed tree depth). But that would be a concept which is completely different than Windows, POSIX or any other widely-used operating system standard. It would be unintuitive to use for users who come from these platforms and it would be considerable effort to port existing software to such a filesystem or make it interface with a system which uses a hierarchical filesystem.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.