Best Database For Rails?

Hello,

I was wondering if anyone could tell me which database, if any, is
easiest to integrate with Rails?

I know most databases can be used with Rails but I was wondering if
there is one that is easier to integrate than others.

Thanks in advance your replies.

Craig

I think this is one of the best parts of rails, It’s fairly database
agnostic and you can code with a high amount of disregard for what
database is on the back end. If you write against one server and
decide to change, you can do so easily.

Most people are using MySQL with InnoDB tables, or PostgresSQL.

PostgresSQL is the way to go if you want stored procedures, as
there’s a rich amount of language support in Postgres, otherwise,
just use MySQL.

-john

On Thu, 11 Oct 2007, Craig N. wrote:

I was wondering if anyone could tell me which database, if any, is
easiest to integrate with Rails?

I know most databases can be used with Rails but I was wondering if
there is one that is easier to integrate than others.

MySQL is by far the most widely used and least problematic.

Oracle is a complete pain to use with Rails… mostly, I suspect,
because Oracle is a complete pain to use. I’m currently using 10g
and unbelievable there is no native “time” type. I’m having to use
a date type which means most of the Rails *_time helpers do not work.

PostgreSQL and SQLite fall somewhere in between in my opinion. I’ve run
into issues with joins and group by clauses trying to use some of the
available Rails plugins. At this point it’s clear to me that most Rails
plugins are only tested against MySQL. Trying to use them with any
other
database is a crapshoot.

I have not tried any others.


Greg D.
Cyberfusion Consulting
http://cyberfusionconsulting.com/

On 10/11/07, Greg D. [email protected] wrote:

PostgreSQL and SQLite fall somewhere in between in my opinion. I’ve run
into issues with joins and group by clauses trying to use some of the
available Rails plugins. At this point it’s clear to me that most Rails
plugins are only tested against MySQL. Trying to use them with any other
database is a crapshoot.

That’s really a shame. We used to use MySQL, and had a lot of custom
finder code that did joins for stats aggregation and stuff. When we
moved onto Postgres all of those queries failed, and we seriously
considered sticking with MySQL. I spent two days getting the queries
to run on Postgres, so we made the switch. Out of curiosity I ran
them on MySQL and they were all fine.

This won’t hold true all the time of course, but I think if people
test their stuff on Postgres they’ll find that it’s pretty much
compatible with the other popular DBs.

Pat

On 10/11/07, Craig N. [email protected] wrote:

Craig

Posted via http://www.ruby-forum.com/.

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
now.

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.

Pat

I have done some exploratory work with DB2, more out of stubbornness
than anything else. There are some minor issues, such as a config
modification, but for me the biggest problem was the 8-character table
naming restriction. If you can live with that, DB2 is certainly
scalable, and the Community version is free. See db2onrails.com for
details. In my limited experience, using DB2 means you have to jump
through hoops, using MySQL everything just falls into place.

Joe

On Oct 11, 2:40 pm, Craig N. [email protected]

Hi Craig

Like what the rest of guys said, Rails is database agnostic. So long
as there is an adapter for it, any database should do fine.
Coming from a MSSQL background, I wsitched to MySQL for the Rails
Project and it has been smooth sailing thus far.
In addition, virtually all articles, tutorials is usually MySQL
centric.

As for PostGresSQL, It is a sophisticated dB and is absolutely
free :slight_smile:
However, in the ActiveScaffold group, there has been reported issues
on dates and case-sensitivity.

Good Luck with whatever you choose !

On Oct 12, 2:40 am, Craig N. [email protected]

On 10/11/07, Greg D. [email protected] wrote:

MySQL is by far the most widely used and least problematic.

Too bad it sucks so much. :slight_smile:

PostgreSQL and SQLite fall somewhere in between in my opinion. I’ve run
into issues with joins and group by clauses trying to use some of the
available Rails plugins. At this point it’s clear to me that most Rails
plugins are only tested against MySQL. Trying to use them with any other
database is a crapshoot.

I have had no issues with PostgreSQL. The more important thing to me
is that I trust PostgreSQL. I know some of the people who have
hacked on it, and they took some code I wrote, so they can’t be all
that bad :slight_smile:

–Michael

On Oct 11, 2007, at 15:18 , Pat M. wrote:

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

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

Hi Michael

With your positive experience in Postgresql, may I trouble you to look
into the ActiveScaffold Group where a few Postgresql users are having
some sorting issues with AS ?

CCH

Mitch P. wrote:
[…]

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.

Not so rare. I’ve been finding lately that PostgreSQL is a better
choice than mySQL for almost anything I’d want to do with mySQL. (At
least it is with PHP – I’m just starting to work with Rails.) mySQL
has so many stupid limitations and lacunae that I have seriously fallen
out of love with it lately – and its implementation of spatial features
is so bad that at the moment, I would not seriously consider it for
anything likely to need GIS functionality.

OTOH, PostgreSQL is somewhat harder to set up, and there are fewer good
graphical tools that work with it (and the privilege system is
ridiculously complex).

I agree with most of the rest of what you wrote, though. See what you
are likely to need to do, and choose the DB that best supports that
feature set.

– Mitch

Best,

Marnen Laibow-Koser
[email protected]

On 10/12/07, Mitch P. [email protected] wrote:

  • 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 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:

–Michael

On Fri, 12 Oct 2007, Michael G. wrote:

On 10/11/07, Greg D. [email protected] wrote:

MySQL is by far the most widely used and least problematic.

Too bad it sucks so much. :slight_smile:

/me ignores the database-on-sleeve-wearing-comment0r.


Greg D.
Cyberfusion Consulting
http://cyberfusionconsulting.com/