Reputation:
Consider I modify the way files are stored in a system, where every file name would actually be the table name in a database and each line in the file would actually be the rows of that table. Would that increase overall system speed? would it be worthwhile? what are the tradeoffs?
To further clarify the distinction between this and the normal use of a database, consider the files not to simply be text files, but also audio, video, binary, etc. where they are stored in the manner mentioned in the previous paragraph.
Immediate benefits that I can see from this is that i can read/write any line from/to a file without having to repeatedly read/write the previous lines until reaching the desired line. Another benefit would be simultaneous reading/writing of files.
Please do not confuse this with a database file system, this is a file implementation
Upvotes: 0
Views: 129
Reputation: 39916
To add to your benefit of reading writing by location, the additional benefit are.
Pros
Indexing
Indexing the text with full text indexing that can give searching benefits. Ofcourse the size of database will probably be more then the conventional file sizes. But you have benefit in terms of performance because database system will have only one file handle open, and it will do caching and will improve performance and cause less fragmentation.
Lock/Performance
Opening/closing multiple files will put little more overhead in terms of performance because each open/close requires access control check and locking.
Replication
Replication benefits, if you put them in mysql, mysql replication is easy to setup and you can keep multiple backups easily.
Maintanence
Transfering, maintaining and querying database will be much easier then in terms of files.
Cons
File Browser Access
You can not access files through explorer or normal file system api, you will need some sort of access api probably REST based api or some viewer that can read the database.
You can check my blog about more detailed analysis.
Upvotes: 2
Reputation: 6934
Maybe some benefits on speed are present, but there's a lot of issue which make the cons overwhelm the pros.
I guess that if you write something which support all this kind of issues you've written a sql engine...
Upvotes: 0