SQLite vs. MySQL
Posted Mar 6, 2007 7:37 UTC (Tue) by
njs (subscriber, #40338)
In reply to:
Upcoming PHP release will offer Unicode support (Linux.com) by epa
Parent article:
Upcoming PHP release will offer Unicode support (Linux.com)
>Isn't SQLite even more horrible than MySQL?
Definitely not. It's true that SQLite doesn't support foreign keys out of the box -- though you can add them manually if you want[1] -- and has an unusual approach to types. (You might be able to add column-based type checks by hand too, I'm not sure.) If I were designing SQLite, it would definitely have static typing.
But, while these design choices are somewhat odd, they're valid and well-documented, and the resulting system is very simple and predictable. The key word is "predictable" -- there is *nothing* more important for a database than predictability, because only predictability gives you a solid foundation to build your actual app on. And in addition, SQLite's author hits all the right points everywhere else -- >95% test coverage including coverage of all edge cases, robust transaction handling, etc. etc. It's not suitable for all uses, but that's because it doesn't try to be, not because it will suddenly blow up in your face at a critical moment -- it's extremely good at what it does.
Compare to MySQL, where you *have* e.g. type checking for dates, but you can't actually rely on it. (Or didn't use to be able to.) And you might have transactions that work, or you might not -- hope you didn't accidentally use the wrong database type! And you have a developer team that has in the past hit all kinds of wrong notes, basically sending the message that they didn't think these problems were important.
I can't personally verify that there are no race conditions in my database's code to do rollback recovery after a power outage -- it's almost impossible to do. I just have to trust that the developers spent a few months bashing their face against the wall thinking of all the edge cases and accounting for them. The biggest problem with MySQL was always that you just couldn't trust the team to be killing themselves to achieve robustness. D. Richard Hipp, OTOH, has consistently earned that trust. It's all the difference in the world.
[1] http://www.sqlite.org/cvstrac/wiki/wiki?p=ForeignKeyTriggers
(
Log in to post comments)