Rails with PostgreSQL or MySQL?

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!

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

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

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.