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!

  • femtech
    link
    fedilink
    English
    13
    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.

  • Jeena
    link
    fedilink
    English
    113 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
      23 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.

  • @lambalicious@lemmy.sdf.org
    link
    fedilink
    English
    83 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.

  • @ShittyBeatlesFCPres@lemmy.world
    link
    fedilink
    English
    -23 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.)

  • @droopy4096@lemmy.ca
    link
    fedilink
    English
    33 months ago

    My opinion is that of the two Postres is more “adult”. So if you want to"just wing it" MariaDB would work, but if you’re serious Postgres is a better choice. However Postgres also requires better understanding of you setup etc. So it’s a ROI game - what’s more important to your project, how complex your DB is, what are the requirements for availability, transaction security etc. There is no “better” or “worse” there’s “feasible” and “prohibitive” 😉

  • Max-P
    link
    fedilink
    English
    803 months ago

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

    • @pageflight@lemmy.world
      link
      fedilink
      English
      293 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.

  • @msage@programming.dev
    link
    fedilink
    English
    9
    edit-2
    3 months ago

    Postgres is far superior in every way.

    We used MySQL (and Percona XtraDB) servers at work, and it is so bad. So I made several presentations showing generic and specific reasons why Postgres is better. I had to cut a lot of content because MySQL is just that bad.

    Some things may not seem relevant now, but as you keep the DB around long enough, you will appreciate the whole package of Postgres.

    Things that will help a lot, but are extensions:

    • pg_partman - for automatic partition management
    • patroni - management of replicas, automatic failover - it does everything for you with simple commands

    There is a DB comparison matrix, but hasn’t been updated in over a year, which is a shame, but still gives you the idea of how different databases support SQL features: link.

    Spoiler: postgres has the most support, with a huge lead

    Edit: MySQL is dead last, btw

  • @sugar_in_your_tea@sh.itjust.works
    link
    fedilink
    English
    14
    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
  • @threesigma@lemm.ee
    link
    fedilink
    English
    183 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.

  • @zoostation@lemmy.world
    link
    fedilink
    English
    593 months ago

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

  • @rumba@lemmy.zip
    link
    fedilink
    English
    43 months ago

    Hardly anyone ever says mysql is better. Postgres has a lot of nice features, But they’re still a hell of a lot more people out there with mySQL experience.

    If for some reason you really want to go mysql I would urge you to look into percona and percona tools. It’s incredibly fast super optimized. The tools let you do backups that my sequel could only dream of.

    That said, if you don’t have any strong needs for mySQL, and you don’t have any experience with it I would probably start picking up postgres.

    • @DeadMartyr@lemmy.zip
      link
      fedilink
      English
      83 months ago

      I used MariaDB for school projects, what exactly is wrong with it? Asking because I’m just unaware

      • @earmuff@lemmy.dbzer0.com
        link
        fedilink
        English
        -11
        edit-2
        3 months ago

        While there was a time, where those databases were considered “good”, they are only this famous because they have been free or open source for ages. Professors love open source stuff. This does not necessarily mean it is a good product in terms of database functionality. They have been stuck in the old age and simply get outperformed by almost anything. Professors also hate to change their slides and to learn something new. Because their priority is on functionality, not on real world use. And when you want to use a product in the real world, non-functional properties gain a lot of value. One of them is performance.

        If you want to have a fast, reliable, open source database, use ClickHouse.

          • @earmuff@lemmy.dbzer0.com
            link
            fedilink
            English
            03 months ago

            Smear campaign with an open source product? Are you sure you still have a working organ between your ears?

            That being said, my recommendation is based on using databases in big data environments for 15 years. But I am glad that your home lab is working fine with MariaDB. Does not mean it is a good product. And your comment just proves my point.

        • @sugar_in_your_tea@sh.itjust.works
          link
          fedilink
          English
          2
          edit-2
          3 months ago

          Generally speaking, if a professor recommends something, it probably sucks. Their information is incredibly outdated and is usually whatever they used in their own undergrad program.

          At school I learned:

          • Java
          • PHP
          • MySQL
          • C#
          • C++
          • Racket (Lisp)

          Each of those has a better alternative, with C# being the least bad. For example:

          • Java -> Kotlin
          • PHP -> Python
          • MySQL -> SQLite or Postgres
          • C# -> Python (desktop QT GUIs) or web stack (e.g. Tauri for desktop web stack)
          • C++ -> Rust (non-games) or a game engine
          • Lisp -> Haskell

          Formal education is for learning concepts, learn programming languages and tools on your own.

    • Björn Tantau
      link
      fedilink
      English
      63 months ago

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

        • 𝕽𝖚𝖆𝖎𝖉𝖍𝖗𝖎𝖌𝖍
          link
          fedilink
          English
          63 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.

          • @Forester@pawb.social
            link
            fedilink
            English
            43 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