r/programming • • Sep 24 '20

PostgreSQL 13 Released!

https://www.postgresql.org/about/news/2077/
1.3k Upvotes

236 comments sorted by

View all comments

60

u/tomma5o Sep 24 '20 edited Sep 24 '20

Sorry FE dev here, why you guys prefer postgreSQL over mySQL?

-1

u/bloody-albatross Sep 24 '20 edited Sep 24 '20

What is "normal SQL"? Are you trolling?

Edit: The comment I replied to originally said "normal SQL" instead of "MySQL".

7

u/tomma5o Sep 24 '20

Just an error :) donโ€™t want to create a black hole of downvotes :)

2

u/bloody-albatross Sep 24 '20 edited Sep 24 '20

And now I got the down votes, great. But on the topic: PostgreSQL hast many features that MySQL is lacking, you can write triggers in many languages, have great JSON(B) features, no utf8_mb4 nonsense but utf-8 works as expected, unbounded text is also the most performant string type, many little things when it comes to SQL features, much stricter typing, great documentation (SQLite devs say they used the PostgreSQL doc when developing SQLite because it's so good) etc. Oh and arrays! So handy! Also composite types, but I haven't used them yet (not supported by the ORMs/query builders I've used). And the GIS integration is great too if you have to anything with longitude/latitude (you don't want to do distance calculations on the surface of the Earth manually). Does MySQL have functional and conditional indices now? Materialized views? They say upgrading and replication is nicer in MySQL, though. Ah yes and you don't want to have too many connections with PostgreSQL, because it uses a fork for each connection.

A little thing: Escaping table/column names uses standard SQL syntax ("strange table name") where MySQL uses something proprietary (`strange table name`). You can enable the standard syntax in MySQL now, but its not default and I'm weary on how it interacts with query builders and such. Maybe it's fine.

People sometimes say MySQL is easier to setup, but I don't get this. I usually just use the docker image and there it is dead easy, just like MySQL in docker. And not using docker it is still dead easy with your Linux distribution's package manager.

MySQL is maintained by Oracle. Take that as a pro or con, your choice. ๐Ÿ˜„

Edit: Oh one more thing: MySQL doesn't support transactional schema changes. So if there is some error in your migration your DB will be in an inconsistent state.