# Rails with PostgreSQL or MySQL?

**URL:** <https://www.ruby-forum.com/t/rails-with-postgresql-or-mysql/108378>\
**Category:** Rails\
**Created:** [July 2, 2007, 11:00pm UTC](https://www.ruby-forum.com/t/rails-with-postgresql-or-mysql/108378 "2007-07-02T23:00:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwalsh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Post date:** [July 2, 2007, 11:00pm UTC](https://www.ruby-forum.com/t/rails-with-postgresql-or-mysql/108378/1 "2007-07-02T23:00:15Z")

</div>

Hello,

My company is currently using Rails with PostgreSQL. We have lots of  
performance issues and some of the developers/admins think that  
switching to MySQL will solve at least some of the problems since so  
many Rails enthusiasts use MySQL. From my own research on the issue, I  
have not seen that MySQL is consistently better than PostgreSQL at  
anything really. I have noticed that PostgreSQL seems to outperform  
MySQL significantly given multiple cores. Can anyone share with me an  
educated opinion on the matter or point me to some resources where I  
can find more information? Thanks!

---

<div class="post-metadata">

**Author:** ![mwalsh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Post date:** [July 2, 2007, 11:16pm UTC](https://www.ruby-forum.com/t/rails-with-postgresql-or-mysql/108378/2 "2007-07-02T23:16:19Z")

</div>

> My company is currently using Rails with PostgreSQL. We have lots of  
> performance issues and some of the developers/admins think that

That’s fairly broad… can you elaborate? It could be a variety of  
things… postgresql is misconfigured… rails is misconfigured…  
you’re  
asking for things the wrong way, etc. etc.

If there’s a problematic query, what happens if you run that directly in  
postgresql? does the problem go away?

if not, a post to the postgresql mailing list with details on your  
configuration might help.

Without anything else to go on I wouldn’t advise switching to MySQL  
until  
you know it’s a postgresql problem that can’t be solved (in a reasonable  
time frame, etc…)

-philip

---

<div class="post-metadata">

**Author:** ![mwalsh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Post date:** [July 2, 2007, 11:50pm UTC](https://www.ruby-forum.com/t/rails-with-postgresql-or-mysql/108378/3 "2007-07-02T23:50:25Z")

</div>

On 7/2/07, Matt W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello,
> 
> My company is currently using Rails with PostgreSQL. We have lots of  
> performance issues and some of the developers/admins think that  
> switching to MySQL will solve at least some of the problems since so  
> many Rails enthusiasts use MySQL.  
> From my own research on the issue, I  
> have not seen that MySQL is consistently better than PostgreSQL at  
> anything really. I have noticed that PostgreSQL seems to outperform  
> MySQL significantly given multiple cores. Can anyone share with me an  
> educated opinion on the matter or point me to some resources where I  
> can find more information? Thanks!

I agree with what Philip said, define the problem first. In my  
experience postgresql holds up better under load, and much better with  
complicated queries that contain lots of subselects, aggregates, etc…  
But postgresql has to be tuned. It gives you a superior query  
planner and better/more reliable statistics for tuning, but you have  
to do it.

The postgresql lists are great, you should really ask your question  
there, but be prepared to give a lot more information such as an  
explain analyze for the queries that are slow, etc…

Chris

---

<div class="post-metadata">

**Author:** ![mwalsh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/91b2a8/32.png) [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Post date:** [July 3, 2007, 3:19am UTC](https://www.ruby-forum.com/t/rails-with-postgresql-or-mysql/108378/4 "2007-07-03T03:19:43Z")

</div>

As Chris said, out-of-the-box configs of Postgres are pretty terrible

- they seem to be designed to run on the absolute minimal hardware  
config.

Check the Postgres mailing lists, or dig into the site for performance  
info. I’ve had no trouble getting big multiples of performance  
increase out of Postgres on several different occasions by changing a  
few parameters.

Regards

Dave M.
