this post was submitted on 14 Sep 2023
117 points (96.8% liked)

Programming

17534 readers
197 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 2 years ago
MODERATORS
all 19 comments
sorted by: hot top controversial new old
[–] [email protected] 44 points 1 year ago (6 children)

What would we do without postgres? How does anyone justify another SQL DB these days?

[–] [email protected] 26 points 1 year ago (1 children)

We use SQL Server at work and I really don't get why. It's so expensive. We're hosting it on AWS as well. I can't remember the numbers but it's several times more than a similarly specced postgres and we're only using Standard edition.

I don't think we're really using any features that would stop us moving over, it's really just inertia and in-house knowledge.

[–] [email protected] 15 points 1 year ago (2 children)

Sounds like an opportunity to be the shepherd of change that saves the company money.

Beware of one-trick database admins (if you have those) and salespeople who earn their living fighting such changes.

[–] [email protected] 7 points 1 year ago

Yeah I've been dropping not very subtle hints. We're only a small company, about 25 people. We don't have any dedicated database admins at all.

It's on the list I think but we don't have the people to spare to get it done.

[–] [email protected] 15 points 1 year ago (3 children)

You sure know how to bring up the elephant in the room. But mysql is decent enough too, not my favourite, but good enough.

[–] [email protected] 10 points 1 year ago

Mariadb, maybe.

[–] [email protected] 8 points 1 year ago

It certainly was a strong competitor fifteen years ago. If only they kept pace

[–] [email protected] 6 points 1 year ago
[–] [email protected] 8 points 1 year ago (2 children)

Can you elaborate? I'm deciding on what type of SQL to use for my lab and am thinking about MySQL. Should we reconsider?

[–] [email protected] 24 points 1 year ago

You absolutely should. There are many issues with MySQL but I'll give you a very compelling one.

Let's say you want to use a database transaction while you're modifying your table structure to ensure if something goes wrong your data is screwed (causing you to have to restore a backup, etc).

With MySQL any table alterations will persist even though data modifications will be rolled back.

With Postgres, if you cancel/rollback that transaction it all goes back to exactly how it was before.


Another great example is the unique constraint enforcement.

In Postgres if you want to swap two unique values between two rows, you just put it in a transaction and do it.

In MySQL, you have to set one of the values to a temporary garbage value, then change the other value, then change the temporary garbage value to what it should've been.


Another example, if you have a column that's INT NOT NULL...

If you insert a NULL, Postgres will give you an error, MySQL will silently insert 0.

[–] [email protected] 8 points 1 year ago (1 children)

I don’t know exactly what environment you’re working, but Postgres has a reputation as the best DBMS to work with from a developer’s perspective. I definitely feel that way, at least.

What type of lab are you working in, and what other technologies do you work with?

[–] [email protected] 6 points 1 year ago (1 children)

I'm the director of technology for a neurology lab, where we collect patient health record data in a variety of disparate machines and modalities (e.g., MRI, EEG, physical functioning, retinal scans, etc.). We've been using the open-source database software REDCap (basically a wrapper for MySQL that enables easy GUI-based data entry), but we are reaching the limits of what it can handle and need something that can scale with our growing database.

I have little experience in database management myself, but I am a competent programmer and feel comfortable learning whatever is needed (famous last words, I know).

[–] [email protected] 3 points 1 year ago

I have experience running both at global scale (self managed, AWS RDS & GCP CloudSQL). Developer experience = postgres, management/sysadmin = MySQL/maria

[–] [email protected] 6 points 1 year ago (1 children)

Sqlite is simple.

But I get what you mean, for large projects salute is not an option. Its embeddability is unbeatable though. open_database(":memory:") is so unbelievably convenient.

[–] [email protected] 3 points 1 year ago (1 children)

Sqlite is nice and fast. I think the only disadvantage is you can't connect to it from multiple processes or machines, so scalability goes out the window.

[–] [email protected] 1 points 1 year ago

You can, but only one can write at a time, which may or may not be a problem :)

[–] [email protected] 4 points 1 year ago

We use DB2, but mostly because we call it from a mainframe.

[–] [email protected] 2 points 1 year ago

I've heard that it doesn't scale well. Something to do with the vacuum process? I don't remember. Personally, I don't really buy it.