Best Database For Rails?

PostgreSQL, and anyone who says otherwise is a doo doo head.

I'm just kidding of course. It really doesn't matter for the most
part, especially if you're deciding between MySQL and Postgres.
Postgres lagged in Rails support early on, but it's on par with MySQL

If you've got special needs, then you know enough that you'll be able
to determine which database you should use. Between MySQL and
Postgres it just doesn't matter, in my experience. We use postgres
because we just feel more comfortable with it. Of course, there are a
lot of other supported DBs besides those two.


Oh man, you made me choke on my cereal laughing at that one. I agree but can’t say it with such eloquence :wink:

Seriously though, to me databases are just like tools - sometimes you need a hammer, and sometimes a power drill is needed. Here’s how I qualify my decision/recommendation:

  • development - sqlite3 works well in most cases, and keeps the entire database in a single file which is convenient

  • small-to-big sites, low complexity - mysql is great for this, it’s platform agnostic, easy to get help with, and simple to use

  • high complexity applications - postgresql provides so much more under the hood than the other FOSS competitors, and has proven to scale as well as mysql, and in some instances scales better

I’m a big postgresql homer, and am durned proud of it, but I also have some clients that are quite happy with their database of choice, whether it be mysql, oracle or whatever. Rails is fantastic in this regard.

In the end, see what the skillsets are of your customer, or of the people that actually have to work with this application once it goes live. That will ultimately drive your decision, unless you can find the rare occurrence where one platform specifically outperforms the others.

– Mitch

I would highly recommend that, for development and testing, you use
the database you expect to use in production. This implies that if
you expect to use mysql, postgresql, or oracle you use each of these
at various times in development.

In most cases I've locked my database down to postgresql. It's what I
know, and find I like it the best. However, if I expected people to
run my code on mysql, I'd have that on my laptop and postgresql on my
desktop or something. At least then I could run 'rake test' and have
it work as I hoped. :slight_smile: