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!

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.

Cousin Mose
link
fedilink
English
222M

Another vote for Postgres, MySQL kind of blows.

Dark Arc
link
fedilink
English
302M

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.

Possibly linux
link
fedilink
English
152M

You aren’t exposing the database right?

@expr@programming.dev
link
fedilink
English
162M

Postgres, hands down. It’s far better than MySQL in every way.

@friend_of_satan@lemmy.world
link
fedilink
English
42
edit-2
2M

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.

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.

So, you fucked up and it’s postgres’ fault?

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.

femtech
link
fedilink
English
13
edit-2
2M

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

Postgis for images

CloudNative-pg for running DB clusters in kuberneties.

@threesigma@lemm.ee
link
fedilink
English
182M

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.

Jeena
link
fedilink
English
112M

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
22M

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.

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.

Kalreus
link
fedilink
English
22M

It’s not My SQL, it’s Orcales.

Radioactive Butthole
link
fedilink
English
62M

TheirSQL

@CeeBee_Eh@lemmy.world
link
fedilink
English
22M

Who’sSQL?

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.

@Forester@pawb.social
link
fedilink
English
92M

Maria database is free and open source. It uses MySQL format.

Björn Tantau
link
fedilink
English
62M

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

Maria database is free and open source.

Why are you implying that PostgreSQL isn’t?

David From Space
link
fedilink
English
112M

Well mySQL certainly is not, I judge this to be a correct statement!

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
42M

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

Max-P
link
fedilink
English
802M

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

shnizmuffin
link
fedilink
English
22M

Same.

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.

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.)

Create a post

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don’t control.

Rules:

  1. Be civil: we’re here to support and learn from one another. Insults won’t be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it’s not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don’t duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

  • 1 user online
  • 71 users / day
  • 461 users / week
  • 1.47K users / month
  • 4.07K users / 6 months
  • 1 subscriber
  • 4.24K Posts
  • 87.9K Comments
  • Modlog