2010/1/25 Xavier Shay <[email protected]> > On 25/01/10 12:35 PM, Jason Stirk wrote: > >> ... Deployment database? >> MySQL, recently played a bit with Postgres (although I'm still >> unimpressed) >> > This is contrary to most opinion I've heard, so I'm interested in hearing > more. >
What follows is just (ranty) my take on MySQL/Postgres. I'm more than happy to have the record set straight by a Postgres guru... I'm strongly of the opinion that, unless you're admining the installation, things like Rails and ActiveRecord are going to hide just about all the differences between the two anyway. That's, you know, the idea of them... I guess part of my preference for MySQL comes from my familiarity with it: I've admined and used installations of it for about 8 years, as opposed to about 6 months on Postgres. However, permit me to throw caution to the wind and rant anyway! Generally, my thoughts are that MySQL is postfix to Postgres's sendmail. Sure, Postgres has all these extra features, but my experience of it is crazy arcane syntax, and a mishmash of CLI and in-client commands. For example, what's with these crazy "\d" commands just to do simple things like showing a list of databases or table? "SHOW DATABASES" or "SHOW TABLES" might be longer to type, but they're trivial to remember. (I'm prepared to have my ass handed to me here, explaining a simple, in client way of doing this in Postgres... Please, hand away...) I was also very unimpressed with the way postgres created and managed DBs and users (createdb, and friends). The idea of CLI tools (like "createdb") to manipulate the state within a daemon process does give me the creeps more than a little... Many folks give the excuse that MySQL is a "toy" database, as the older versions lacked stored procedures, triggers and the like. Whilst that's been changed recently, realistically, I'm prepared to call bullshit when this justification comes up in the context of web dev: YAGNI anyway... In fact, I'd be very interested to talk with any Ruby web developer who's ever needed stored procedures, triggers, or anything like that. I'm genuinely interested to know what situation could have called for them in the web world, and how they actually benefited your project. That's not to say I think they're unnecessary on the whole - there are a metric shitload of uses where they're essential to preserve DB integrity, or speed things up when load dictates, but in the web world, I'd be very surprised if you're grabbing these tools early on in the game. (Unless you're writing a web console for a nuke reactor, or rebuilding the ASX on Rails...) To be honest, these advanced features are probably going to be a pain to work with if you're using a ORM layer anyway, whether it's ActiveRecord or something else. (Not to mention that the idea of code in the DB layer scares the crap out of me...) (Offtopic -1: Hell, do things like foreign key constraints even work reliably in ActiveRecord yet?!?) Configuration wise, MySQL is a snap to work with, and it's all pretty damn logical how it all hangs together. If you want a low memory deployment for dev, or a dedicated DB server, MySQL can handle it with just a few tweaks. Sure, there's a bit of thought work involved when looking at the pros and cons of each engine for the tables, but even that's pretty simple, and only going to happen when you define your schema. Plus, that is less of a question now that awesome tools like Sphinx reduce the need to do in DB fulltext search (so why the hell would you use MyISAM? Unless you really, really dig table-level locking!) Finally, when you _do_ need to outgrow a single DB installation, you still have the ability to look at replication or the like. I can't claim to have set it up myself, but I've read up on it, and it really doesn't look _that_ hard. I believe that multi-master replication is impossible/very hard out of the box with MySQL, but if you've got enough load to need to deal with that kind of issue, good luck to you! If you're interested in more advanced topics about MySQL, check out O'reilly's "High Performance MySQL" by Jeremy Zawodny (who moved all of Yahoo! Finance over to MySQL from BDB in 2000/2001). It's probably a tad dated now (6 years old) but is well worth the read for some interesting ideas. Thus concludes my rant for the evening. J -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
