What are the benefits of postgreSQL?

Hi all,

I have always used MySQL for databases, but most things I read on Rails seem to use PostgreSQL.

What are the benefits of using PostgreSQL? and should I switch?

Thanks,

Postgresql is more closer to the standard as defined by the ISO. Plus the community is more active.

As already mentioned, it’s the closest to ANSI-standard SQL I’ve come across. Additionally, it tends to have faster development cycles than MySQL, with new features (hstore, json, jsonb, materialized views) coming every year.

If you have a production app already running on MySQL, I’d say you probably should not switch. Unless your app is very vanilla, it’s likely not to be equivalent. If your app is new then I’d say go with Postgres as it seems to have more going for it right now.

4 Likes

@derekprior’s comment +100.

While ActiveRecord ostensibly makes your application database agnostic, leaving open the promise of being able to swap out databases without code changes, even fairly straightforward applications tend to have some custom SQL or database-specific features that don’t port from one database to another. Aaron “tenderlove” Patterson of Rails Core fame joked that developers are always trying to build apps in case they might switch one day in the future, but since switching is essentially a rewrite-level change for most apps, no one ever does.

I found the transition to PostgreSQL to be a little rocky after several years of doing some sloppy things in MySQL. The Postgres docs have some tips for folks moving from MySQL. In addition to the stricter rules on quoting and capitalization, the item I found hardest to adjust to were rules around GROUP BY and other grouping/aggregating functions.

I will stick to MySQL until I create a new project then.

Thanks guys :slight_smile: