3
9 Comments

Ask IH: Why should I learn PostgreSQL, what makes it worth the time? (PostgreSQL vs MySQL)

Hi!
I want to start a tough discussion: why should I learn PostgreSQL, spend time on that & migrate all my projects to PostgreSQL over MySQL?

Currently, for years I'm fully into MySQL. What makes it worth the time to jump into PostgreSQL? How does it help you? Is PostgreSQL better than MySQL? Why?

What's your experience with that? Is there anyone who switched from MySQL to PostgreSQL and wants to share their thoughts?

  1. 5

    As others have mentioned: If you have no problems with MySQL, there's probably no reason to switch.

    My personal reasons for switching from MySQL to PostgreSQL were:

    1. I had a lot of trouble finding documentation and help in MySQL. Postgres is insanely well documented and I had no problems finding stuff.
    2. UUIDs are natively supported in PostgreSQL. It's just one thing I don't have to worry about. I don't have to store it in binary, Postgres knows the data type and can (potentially) optimise it.
    3. Support. Libraries for PostgreSQL seem to be far better supported and loved by programmers than their MySQL counterparts. Especially in the NodeJS world the Postgres Packages were better maintained (and existent).

    In the end: I switched because I am lazy and I'm very happy with my decision.

  2. 4

    Postgres:

    • has better and more complete SQL functions than MySQL, saving you time;
    • is rock solid and has better index support than MySQL, for better performance and saving you errors;
    • has top quality client libraries, rather than the ones for MySQL, saving you time;
    • is faster and more complete than MongoDB, and does not crash during modeste loads like the latter;
    • has a full native search engine inside and can be even faster than Elasticsearch.

    Outcomes: much less time spent doing development and sysadmin, better performances, lower cost for servers.

    1. 2

      However, don't migrate just for have a better database. You can start to use Postgres for some things like the search engine or new services making some experience, then migrate the rest only if you see a clear gain.

  3. 2

    I switched from MySQL and MongoDB to PostgreSQL 10 years ago for several reasons that I don't remember well.

    However, I remember one day, that I was executing a SELECT and MySQL didn't use the correct index. Then I realized that MySQL had a USE INDEX hint in order to "help" with the query execution plan. I thought PostgreSQL might be clever than MySQL, because you don't have to help PostgreSQL to select the correct index. :-P

    And, what about MongoDB, one day I was querying a list of Spanish provinces ordered by name and the result was ..... Murcia, Málaga, .... They didn't have COLLATIONs, and "á" (with accent) was ordered after "u". And they didn't have plans to add this during more than 2 years. Then, when I discovered that PostgreSQL was faster than MongoDB even managing JSON data, I switched to PostgreSQL.

    But in general, I consider that MySQL and MongoDB are good products also.

    However, I have never had the need to look at them again since I switched to PostgreSQL.

    1. 2

      Thanks for the real examples :)
      About USE INDEX, a few days ago I had a similar issue with MySQL, and it got me thinking about my database choices :)

      I think I'll give PostgreSQL a chance in a new future!

  4. 1

    Use whatever gets to your product the fastest. Your customers don't care if you use mysql, pgsql, some fancy cloud DB, flat file, or pen/paper. They care that it works, fast, and cheap.

    IF you ask me, i say only if your new project REQUIRES it (example, pgsql is good with django). And FYI, mysql /pgsql syntax are very similar. So not a HUGE switching cost.

  5. 1

    It depends on the reason. PostgreSQL is more complex.

    If your projects are working fine with MySQL then there is no reason to migrate.

  6. -1

    This comment has been voted down. Click to show.

  7. -1

    This comment has been voted down. Click to show.

  8. 1

    This comment was deleted 2 years ago.

Trending on Indie Hackers
How I grew a side project to 100k Unique Visitors in 7 days with 0 audience 49 comments Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 29 comments My Top 20 Free Tools That I Use Everyday as an Indie Hacker 17 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments