# Database Selection

**URL:** <https://www.ruby-forum.com/t/database-selection/53235>\
**Category:** Rails\
**Created:** [January 30, 2006, 3:36am UTC](https://www.ruby-forum.com/t/database-selection/53235 "2006-01-30T03:36:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f08c70/32.png) [@brandon](https://www.ruby-forum.com/u/brandon)\
**Post date:** [January 30, 2006, 3:36am UTC](https://www.ruby-forum.com/t/database-selection/53235/1 "2006-01-30T03:36:25Z")

</div>

Hi,

I am a RoR newbie and I’ve been experimenting with different databases  
(mySQL, PostgreSQL, etc.) and different table types (MyISAM vs. InnoDB).  
Is there a preferred database/table type for RoR development. I like  
how MySQL’s InnoDB tables enforce referential integrity, but these  
tables require a lot more storage space then MyISAM tables.

For everyone with a lot of RoR experience, what database setup do you  
prefer?

B

---

<div class="post-metadata">

**Author:** ![brandon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f08c70/32.png) [@brandon](https://www.ruby-forum.com/u/brandon)\
**Post date:** [January 30, 2006, 3:55am UTC](https://www.ruby-forum.com/t/database-selection/53235/2 "2006-01-30T03:55:42Z")

</div>

I’d imagine that’s a dangerous question to ask. Regardless of what  
everyone’s opinions and personal preferences are, the bottom line is  
that  
the best one is the one that works best for you.

You can’t go wrong with Postgres or MySQL. If using MySQL, use the  
INNODB  
tables, it supports better application design albeit with a higher  
maintenance cost.

I prefer MySQL simply for the reason that I’ve been using it for 9  
years. If  
I had business reasons for needing a full-featured database, then  
Postgres  
would be my choice.

Bob S.  
[http://www.railtie.net/](http://www.railtie.net/)

---

<div class="post-metadata">

**Author:** ![brandon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f08c70/32.png) [@brandon](https://www.ruby-forum.com/u/brandon)\
**Post date:** [January 30, 2006, 4:01am UTC](https://www.ruby-forum.com/t/database-selection/53235/3 "2006-01-30T04:01:44Z")

</div>

You can use either, I don’t think it really matters a lot to be  
honest. I love postgresql, but I can’t really articulate why. If you  
are really interested in DB constraints I’d recommend postgres simply  
because it has excellent support (I admit I’ve never used any  
constraints in MySQL).

Some Rails users say you shouldn’t have any kind of business logic in  
the DB, while others advocate including some to ensure that the most  
important part of your app - the data - is valid, even if you  
sometimes violate DRY.

Rails makes it really easy to use either, and to switch out without  
noticing a difference really. I imagine when you have to make a  
decision between either one, it will be guided more by how you can  
optimize it for your OS/hardware, you or your support team’s knowledge  
of either db, etc. I don’t think it makes a difference which one to  
go with for the vast majority of general Rails users.

Pat

---

<div class="post-metadata">

**Author:** ![brandon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f08c70/32.png) [@brandon](https://www.ruby-forum.com/u/brandon)\
**Post date:** [January 30, 2006, 5:00am UTC](https://www.ruby-forum.com/t/database-selection/53235/4 "2006-01-30T05:00:00Z")

</div>

Thanks for everyone’s comments so far. I’d feel the most comfortable  
using mySQL, but my only concern is the overhead associated with InnoDB  
tables. Are they really that much larger than MyISAM tables? Do InnoDB  
tables slow down when a lot of records are present?

---

<div class="post-metadata">

**Author:** ![brandon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f08c70/32.png) [@brandon](https://www.ruby-forum.com/u/brandon)\
**Post date:** [January 30, 2006, 4:28am UTC](https://www.ruby-forum.com/t/database-selection/53235/5 "2006-01-30T04:28:47Z")

</div>

I agree, INNODB all the way.

---

<div class="post-metadata">

**Author:** ![brandon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f08c70/32.png) [@brandon](https://www.ruby-forum.com/u/brandon)\
**Post date:** [January 30, 2006, 5:01am UTC](https://www.ruby-forum.com/t/database-selection/53235/6 "2006-01-30T05:01:55Z")

</div>

I’ve always used Postgres over MySQL, and all things being equal would  
continue to do so, but Dreamhost has a killer hosting deal on that  
makes it worth my while to switch to MySQL for at least one project  
(DH doesn’t support Postgres).

Regards

Dave M.

---

<div class="post-metadata">

**Author:** ![brandon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f08c70/32.png) [@brandon](https://www.ruby-forum.com/u/brandon)\
**Post date:** [January 30, 2006, 5:04am UTC](https://www.ruby-forum.com/t/database-selection/53235/7 "2006-01-30T05:04:24Z")

</div>

David M. wrote:

> I’ve always used Postgres over MySQL, and all things being equal would  
> continue to do so, but Dreamhost has a killer hosting deal on that  
> makes it worth my while to switch to MySQL for at least one project  
> (DH doesn’t support Postgres).
> 
> Regards
> 
> Dave M.

Dave,

If you haven’t signed up for DH, I highly recommend it. I’ve been with  
them for over three years and have never had any major problems with  
hosting/email/etc. Their support is top notch also.

Brandon

---

<div class="post-metadata">

**Author:** ![brandon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f08c70/32.png) [@brandon](https://www.ruby-forum.com/u/brandon)\
**Post date:** [January 30, 2006, 5:35am UTC](https://www.ruby-forum.com/t/database-selection/53235/8 "2006-01-30T05:35:13Z")

</div>

Thanks Brandon,

That’s what I did - a bit of Google digging showed that any bad  
experiences that have been reported with Dreamhost seem to have been  
well in the past, and that they’ve now got a good offering at a pretty  
wonderful price. In the few days since I signed up, I haven’t had a  
need to seek their support, so I can’t comment on their performance  
personally at this stage.

Having Rails be so database-agnostic will (hopefully!) make it fairly  
easy to transition this app from its current Postgres backend to  
MySQL. Plus it gives me a good reason to learn about migrations,  
which has been on the never-ending shortlist of Things I Need To Learn  
for a while now.

I’ll still use Postgres for anything that doesn’t get hosted on  
Dreamhost though. Having come from an Oracle/DB2/SQL Server  
background, Postgres fits my sensibilities much better than MySQL  
does. YMMV of course, and what’s right for me won’t necessarily be  
right for you.

Regards

Dave M.

---

<div class="post-metadata">

**Author:** ![brandon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f08c70/32.png) [@brandon](https://www.ruby-forum.com/u/brandon)\
**Post date:** [January 30, 2006, 10:50am UTC](https://www.ruby-forum.com/t/database-selection/53235/9 "2006-01-30T10:50:35Z")

</div>

Dominique P. wrote:

> FYI, at the recent Pasadena Rails Studio by Dave T. and Mike C.,  
> one of them mentioned that transactions won’t work the way you expect  
> with MySQL ISAM tables… even though you may explicity mark that you  
> want something to execute in a transaction, it will not execute in a  
> transaction.  
> I can confirm that. MyISAMs have got a few nasties up their sleeves.  
> The only thing keeping them around in any of my projects is the lack of  
> FULLTEXT indices on InnoDBs. That’s not so much of a problem in Rails,  
> now that we’ve got Ferret, but it’s still annoying.

---

<div class="post-metadata">

**Author:** ![brandon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f08c70/32.png) [@brandon](https://www.ruby-forum.com/u/brandon)\
**Post date:** [February 1, 2006, 10:27pm UTC](https://www.ruby-forum.com/t/database-selection/53235/10 "2006-02-01T22:27:10Z")

</div>

Yah, MyISAM has no transaction support - has nothing to do with Rails.

InnoDB does have transactional support. Hope that Oracle had something  
in  
mind when they bought InnoDB, besides gripping MySQL by the short  
hairs…  
SK

---

<div class="post-metadata">

**Author:** ![brandon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f08c70/32.png) [@brandon](https://www.ruby-forum.com/u/brandon)\
**Post date:** [January 30, 2006, 9:59am UTC](https://www.ruby-forum.com/t/database-selection/53235/11 "2006-01-30T09:59:31Z")

</div>

FYI, at the recent Pasadena Rails Studio by Dave T. and Mike C.,  
one of them mentioned that transactions won’t work the way you expect  
with MySQL ISAM tables… even though you may explicity mark that you  
want something to execute in a transaction, it will not execute in a  
transaction.

Hope this helps!  
Dominique

Brandon wrote:

> Hi,
> 
> I am a RoR newbie and I’ve been experimenting with different databases  
> (mySQL, PostgreSQL, etc.) and different table types (MyISAM vs. InnoDB).  
> Is there a preferred database/table type for RoR development. I like  
> how MySQL’s InnoDB tables enforce referential integrity, but these  
> tables require a lot more storage space then MyISAM tables.
> 
> For everyone with a lot of RoR experience, what database setup do you  
> prefer?
> 
> B

---

<div class="post-metadata">

**Author:** ![brandon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/f08c70/32.png) [@brandon](https://www.ruby-forum.com/u/brandon)\
**Post date:** [February 1, 2006, 11:37pm UTC](https://www.ruby-forum.com/t/database-selection/53235/12 "2006-02-01T23:37:21Z")

</div>

People should be aware that Oracle has purchased the InnoDB engine  
used in MySQL.  
[http://www.databasejournal.com/features/mysql/article.php/3561731](http://www.databasejournal.com/features/mysql/article.php/3561731)

Oracle has stated that when the current contract expires next year it  
is going to change the terms of the InnoDB contract. It has not stated  
how they will be changed.

–  
Jon S.  
removed\_email\_address@domain.invalid
