I came to a very liberating conclusion the other day. I need to stop fucking around with MySQL, or any other RDBMS, and fully embrace a NoSQL server as my primary data store. I’ve been a huge fan of Redis for quite some time but the fact that everything lives in memory can be a pain, especially at the scale that some of my sites are are now. MongoDB was the obvious choice due to it’s maturity and support in PHP. I’m going full-on MongoDB effective immediately.
Why the complete abandonment of MySQL? It’s simply really, I was making system design decisions because of the issues I have run into with MySQL in the past. Why should I continue to choose a system that I have to fight with? Why continue to use an RDBMS that I am merely utilizing as if it were a key/value store? Why not embrace a system that out of the box a better fit for how I think things should work?
What sort of shortcomings did I work around with MySQL? Well for one, the inability to add a new column to a large table (think 10m+ rows) in a timely fashion and without needing to take a site offline was always a sore spot. When this scenario came up, I would just create a new table and migrate the data. It generally had less impact albeit more passive of an approach. The addition of new indices fell into the same boat as well. I avoid VIEWs and JOINs like the plague as well just because sticking to primary key SELECTs has always been speedier than the counterpart.
Don’t even get me started on all of the configuration options for MySQL. At the end of the day, I’m only so good of a database administrator. It’s also not very stimulating in my opinion. I’d much rather be building new features than trying to figure out a series of cryptic options that barely make any sense. The fact that MySQL is better utilized with a caching layer in front of it only complicated matters. I want less services to administer, not more.
This all started to weight on my mind as I am currently working on a new site as well as reimagining my PHP framework’s ORM. I found myself trying to design these systems around all of my painpoints with MySQL thus far. I know some of the aforementioned could be alleviated by switching to PostgreSQL but I would still interact with Postgres in the same manner by avoiding JOINs and such. I was bending to the will of the system instead of the other way around. The insanity had to stop.
If you find yourself talking about all the hacks and the crazy-ass things you’ve had to code to make something work the way you need to it, it’s probably time to invest some time in researching a better system to use. Sure, no system is without shortcomings, you just need to put yourself in a position that you’re not spending more time working around problems than you are being productive and advancing your product.
That all being said, my PHP framework, Pickles, will no longer support any traditional RDBMSes in the soon to finished version 2.0. The core, anything not implemented by the developer, will utilize MongoDB out of the box. Redis support will be baked in but it will be up to the developer to implement it’s usage. Down the road, I’d like to support both Mongo and Redis (as well as other NoSQL systems like Cassandra) for the core sub-systems.
It’s a pretty drastic move, but it feels right and I think it will be worth it in the long run. Does anyone out there know of any other frameworks (PHP or otherwise) that have abadoned their RDBMS support? I mean, aside from the MEAN stack ;) Would love to hear about other frameworks as well as horror / success stories from other folks that have indefinitely abandoned “traditional” technologies in favor of something modern. Comment below!