Re:Why use a database instead of just saving your data to disk?
by kawsper on Sunday May 19, 2013 @04:43PM
(#5734320)
It really depends on your structure I think. In the days of PHP3 I saw a lot of developers that built .txt-backed websites, with complicated parsing that would break when you looked at it.
In my opinion, they would have been better of with a database, or a more clever design like yours probably is.
A lot of my first work was rewriting PHP3 sites that used text-files to PHP4 with MySQL. Some of them had 200mb articles in text-files, and for every request they parsed this file, and didn't know why it was slow.
Re:Why use a database instead of just saving your data to disk?
by betterunix on Sunday May 19, 2013 @06:40PM
(#5734703)
Unstructured data is as bad as unstructured code. Typically, your data will become more complex over time, and structure helps a lot with ensuring that this is not a painful thing to do. Relational databases are well-studied and present a well-understood abstraction, with design patterns (normal forms) that significantly improve the maintainability of databases. Sure, relational DBs are not the only solution; I personally find Lisp s-expressions to be an easier to use Q&D store (of course, I am also a Lisp programmer, and most of my code does not have to deal with untrusted data), and lots of people are using YAML these days (and of course, there is XML).
I also happen to think MySQL-backed websites are the bane of the internet, further testament to the pro-db bias of the average web developer.
A properly built sql store (or, increasingly, nosql) is definitely a necessity for large service. But what is "large"?
I once heard the rule of thumb that a db is necessary when the size of the data you store in it becomes larger than the size of the db code. I kind of like it.