MHN

Ask HN: What are pros and cons of PostgreSQL and MySQL?

186 points by stanhou·3522 days ago·Show in HN

I searched the web but most of the articles are written several years before. Many cons have been fixed.

Add a comment on Hacker News →
2 of 210 comments
  1. We just recently switched from MySQL to PostgreSQL. God we're so glad:

    • add a null column to a big table => have fun and plan your maintenance accordingly. Good luck estimating it. This is basically a no-op in Postgres
    • partial indices; absolutely important for big tables. Think about ticketing systems where in general the number of "open tickets" is much lower than the closed ones
    • being able to use advanced SQL features like window functions can easily be underestimated; you can't use potential you don't have
    • renaming indexes, just like that. If you're into refactoring and lessen developer surprises, you want to have proper names and fix accidently mistakes or just legacy stuff
    • in my experience (but I'm no DBA), the logging of PostgresSQL is much more useful then what I get with MySQL (e.g. deadlocks or slow logs)
    • the EXPLAIN (ANALYZE, BUFFERS) output is ... what you get is beyond comparison to MySQL

    The only technical downside we experienced with Postgres (but in comparison, these things are benign):

    • limit of length of identifiers; even with aliases. This can trip ORMs which try to do some clever naming under the hood
    • you cannot change the order of columns, you can only append at the end

    To me, everything I do with Postgres feels much more predictable, whereas with MySQL it always felt a game of gamble.

  2. Using Drupal, MySQL (or MariaDB) simply works much smoother than PostGres. That is because apparently Drupal has been designed around MySQL. You may be quite sure that if you are having a problem with Drupal on PostGres, that the same problem doesn't exist when using MySQL.

    In 2011, we started out using Drupal with PostGres. After a year or two, we migrated to MySQL.

    I think it's likely that the situation is quite similar with WordPress.