Hey, Threadiverse! I’m looking for informed opinions on database choices.

I can stand up an Internet-facing application and have it use either MySQL or PostgreSQL. Which is the better choice, and why do you think so?

Thanks!

  • @[email protected]
    link
    fedilink
    English
    144 months ago

    Choosing is not so much about whether it’s internet facing or not. From the programmer’s perspective and an administrator’s perspective there are pros and cons to both. As someone looking to self-host, if you want to run a service that works with either, I would make the choice based on what seems the most supported, or which one you feel the most comfortable looking up and performing administrative tasks on. I tend to use postgresql more just because I have more experience with it and can recommend it if that’s what you need, but mysql can be just as good or better in many circumstances. Pick whichever one looks easier to you.

  • @[email protected]
    link
    fedilink
    English
    184 months ago

    Postgres also had the advantage of great support for JSON elements, which gives you the power of a no-sql system like mongo in the package. A major selling point if your schema is evolving.

        • 𝕽𝖚𝖆𝖎𝖉𝖍𝖗𝖎𝖌𝖍
          link
          fedilink
          English
          54 months ago

          Actually, really good point. Sorry, person-I-responded-to. I thought you (PIRT) were comparing Maria to Postgres, when you (PIRT) were referring to Maria vs MySQL.

          Both PostgreSQL and MariaDB are OSS and free; MySQL is covered with cooties and boogers, and you don’t want to get any of it on you.

          • @[email protected]
            link
            fedilink
            English
            44 months ago

            Hi, I’m actually the guy you’re trying to respond to but yes that is exactly what I was trying to State

    • Björn Tantau
      link
      fedilink
      English
      53 months ago

      Maria is MySQL. More specifically it is a fork with many additional features.

  • @[email protected]
    link
    fedilink
    English
    42
    edit-2
    4 months ago

    As somebody who just watched a team implement MySQL for an app that only supported Postgres, I’d go with Postgres.

    I never want to use MySQL again. Postgres or SQLite for relational databases.

    • @[email protected]
      link
      fedilink
      English
      14 months ago

      Ha! My deepest experience with postgres was watching it fall over and wedge daily when run behind red hat’s satellite (the flailing lame foreman one, not spacewalk).

      Wow, was it ever a dog. Yeah, I get it: the company who shat Systemd on the planet can’t be asked to do much better, but still.

  • @[email protected]
    link
    fedilink
    English
    13
    edit-2
    3 months ago

    Postgres. It’s more strict by default, which leads to a lot fewer surprises.

    Here’s my rule of thumb:

    1. SQLite - if it’s enough
    2. Postgres
    3. MariaDB - if you don’t care about your data and just want the thing to work
    4. MySQL - if you sold your soul to Oracle, but still can’t afford their license fee
    5. Something else - you’re a hipster or have very unique requirements
  • Dark Arc
    link
    fedilink
    English
    294 months ago

    PostgreSQL is just better. It’s supports transactions on DDL (things like altering table structure) and enforces unique constraints after transactions complete … so you can actually do a bunch of important stuff (like update your table structure or swap unique values between rows) safely.

  • Jeena
    link
    fedilink
    English
    124 months ago

    PostgreSQL is the more feature rich, but if you don’t care about all those features like saving and searching in json structures, Geo data structures and a to of other stuff because you have a simple APO then MySQL is good enough, maybe even SQLite.

    • @[email protected]
      link
      fedilink
      English
      13 months ago

      Its query planner is also much, much more powerful. Like it’s not even close.

      There’s hardly any good reason to use MySQL today. Postgres is easier and nicer to work with, with a strong community backing it.

      SQLite is completely different from both and has entirely different usecases.

  • @[email protected]
    link
    fedilink
    English
    584 months ago

    Postgres is a more robust and better designed and developed product, also it’s not owned by fucking Oracle.

  • @[email protected]
    link
    fedilink
    English
    11
    edit-2
    3 months ago

    The answer is impossible to answer until you tell us more about your needs. Better choice considering what?

    In general, untill you have terabytes of data or a significant amount of traffic (operations per second) database choice does not matter and you should be using cheaper option, where the cost should be assessed as a derivative of price of hosting, cost per operation, cost to deliver (how familiar you are with it).

    When you have significant amount of data or traffic - only then you should worry about database kind or language. Until then this could be a premature optimization.

  • femtech
    link
    fedilink
    English
    12
    edit-2
    3 months ago

    Postgres, the extensions and open source community have been very helpful.

    Postgis for images

    CloudNative-pg for running DB clusters in kuberneties.

  • @[email protected]
    link
    fedilink
    English
    83 months ago

    I have historically gone with PostgreSQL and had no complaints. The licensing issues concerning MySQL also give one pause (Oracle are greedy bastards who will use any excuse to extract money from captive customers, so depending on their properties is to be avoided). Having said that, these days, SQLite is probably sufficient for many workloads and has the advantage of not requiring a database server.

  • Max-P
    link
    fedilink
    English
    784 months ago

    As someone that admins hundreds of MySQL at work, I’d go with PostgreSQL.

    • @[email protected]
      link
      fedilink
      English
      284 months ago

      Yeah, every time I find some weird annoying behavior or some missing feature in MySQL, PostgreSQL is doing it right.

      That said, also ask yourself if you really need a relational database, or whether an object store or append-only / timeseries db would fit better.