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!

  • ThirdConsul@lemmy.ml
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    2 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.

  • halloween_spookster@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 months ago

    We have both MySQL and PostgreSQL in our production environment. Postgres is way nicer as a user of the DB. I created a document months ago outlining a dozen different things that Postgres does that MySQL either doesn’t do or does worse. I can’t speak to managing the DB as I don’t have experience with that.

  • threesigma@lemm.ee
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 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.

    • pageflight@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 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.

  • zoostation@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 months ago

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

  • friend_of_satan@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    2 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.

    • corsicanguppy@lemmy.ca
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 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.

  • sugar_in_your_tea@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    2 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
  • lambalicious@lemmy.sdf.org
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 months ago

    Absolutely depends on what do you want it for and what resources can you apply on it (learning, set-up, etc).

    That said, MySQL is owned by Oracle. The more-or-less blessed alternative IIRC is MariaDB.

  • barkingspiders@infosec.pub
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 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.

  • ShittyBeatlesFCPres@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 months ago

    The only reason I wouldn’t go with Postgres is if I planned to do other things on the same machine. MariaDB/MySQL has been around forever. You may find something that requires it — Wordpress1, for example, requires MariaDB (or MySQL but use MariaDB) and doesn’t support Postgres.

    Also, there’s solutions like Docker containers if you are running multiple things on the same server. But if you’re just learning and putting one thing on a Raspberry Pi as a project or whatever, you don’t need to learn Docker yet.

    1 I’m not recommending Wordpress. It’s ancient and has security issues all the time. But over 40% of sites on the Net still use it in some form. (I mean Wordpress.org, the open source project. The Wordpress company seems to be having some “crazy CEO” drama at the moment.)

  • Jeena@piefed.jeena.net
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 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.

    • expr@programming.dev
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 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.