DEV Community

Discussion on: Is the database working as expected?

Collapse
kp profile image
KP

Just curious why dev is using postgres vs mysql. What are the benefits?

Collapse
citizen428 profile image
Michael Kohl

You phrased this question like MySQL is some sort of standard and one needs a specific reason to use something else. It's not, and especially in the Ruby/Rails community many people tend to gravitate towards Postgres by default. That said for your average CRUD app written in MVC framework/language of choice, there probably isn't much practical difference between them.

You can find a relatively comprehensive comparison here:

postgresqltutorial.com/postgresql-...

For me the reasons I generally choose Postgres are:

  • Advanced data types (e.g. hstore, array)
  • More flexible default values (e.g. generating them from functions)
  • Materialized views (possible with workarounds in MySql/MariaDB, but I'd rather have them natively)
  • Better indexing options
Collapse
kp profile image
KP

Thanks for the detailed explanation! I don't come from the ROR community so Postgres is foreign to me...and I know a lot of people that fall inthe same boat. Your answer was helpful, so thanks.