116
PostgreSQL 16 Released (www.postgresql.org)
you are viewing a single comment's thread
view the rest of the comments
[-] Dark_Arc@social.packetloss.gg 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.

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

Programming

17314 readers
75 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 !webdev@programming.dev



founded 1 year ago
MODERATORS