Most active commenters
  • sgarland(4)
  • yxhuvud(4)

←back to thread

264 points davidgomes | 38 comments | | HN request time: 0.8s | source | bottom
Show context
paulryanrogers ◴[] No.41875055[source]
Upgrades are hard. There was no replication in the before times. The original block-level replication didn't work among different major versions. Slony was a painful workaround based on triggers that amplified writes.

Newer PostgreSQL versions are better. Yet still not quite as robust or easy as MySQL.

At a certain scale even MySQL upgrades can be painful. At least when you cannot spare more than a few minutes of downtime.

replies(7): >>41875126 #>>41876174 #>>41876232 #>>41876375 #>>41877029 #>>41877268 #>>41877959 #
slotrans ◴[] No.41876232[source]
"Not as robust as MySQL"? Surely you're joking.
replies(3): >>41876309 #>>41876384 #>>41877139 #
1. sgarland ◴[] No.41876309[source]
They’re not wrong. If you’ve ever spent meaningful time administering both, you’ll know that Postgres takes far more hands-on work to keep it going.

To be clear, I like both. Postgres has a lot more features, and is far more extensible. But there’s no getting around the fact that its MVCC implementation means that at scale, you have to worry about things that simply do not exist for MySQL: vacuuming, txid wraparound, etc.

replies(3): >>41876387 #>>41876650 #>>41877061 #
2. wbl ◴[] No.41876387[source]
Yeah but you don't need to worry about your data existing. MySQL has been known to silently fail the one job of a DB.
replies(2): >>41876576 #>>41876737 #
3. SavageBeast ◴[] No.41876576[source]
I recall this being the case A LOOOONG time ago but I haven't heard of, read about, been warned to look out for or personally seen such a thing in forever. Have you?

* I'm running a lot of MySQL stuff and such a topic might be of interest to me

replies(2): >>41876711 #>>41876762 #
4. lelanthran ◴[] No.41876650[source]
My experience of both is that MySQL is easier for developers, PostgreSQL is easier for sysads.

That was true in 2012; dunno if it still applies though.

replies(3): >>41876791 #>>41877270 #>>41877996 #
5. o11c ◴[] No.41876711{3}[source]
From what I can tell, MySQL is supposed to be safe since 2018 if you have no data from before 2010.

The fact that you still can't use DDL in transactions makes life exceedingly painful, but it's technically safe if you write your migration code carefully enough.

replies(2): >>41876795 #>>41877299 #
6. maxk42 ◴[] No.41876737[source]
Not in around 15 years. You're thinking of when MyISAM was the default storage engine for MySQL. It has been InnoDB for over a decade. InnoDB is very reliable - I've never had a single data loss incident in all that time, and I've managed some very large (PB-scale) and active databases.

Postgres is definitely more difficult to administer.

replies(2): >>41877978 #>>41878085 #
7. elisbce ◴[] No.41876762{3}[source]
Yes, it is messy when you want your MySQL databases to be mission critical in production, e.g. handling a large amount of customer data. Historically MySQL's High Availability architecture has a lot of design and implementation issues because it was an afterthought. Dealing with large amount of critical data means you need it to be performant, reliable and available at the same time, which is hard and requires you to deal with caching, sharding, replication, network issues, zone/resource planning, failovers, leader elections and semi-sync bugs, corrupted logs, manually fixing bad queries that killed the database, data migration, version upgrades, etc. There is a reason why big corps like Google/Meta has dedicated teams of experts (like people who actually wrote the HA features) to maintain their mission critical MySQL deployments.
8. sofixa ◴[] No.41876791[source]
I doubt it was true in 2012, because sysadmins would be the ones trying to make it run reliably, including things like replication, upgrades, etc.

Pretty sure that even in 2012 MySQL had very easy to use replication, which Postgres didn't have well into the late 2010s (does it today? It's been a while since I've ran any databases).

replies(2): >>41876810 #>>41878057 #
9. The_Colonel ◴[] No.41876795{4}[source]
Lack of transactional DDL is certainly painful, but not unique for MySQL. Oracle doesn't support it either.
replies(2): >>41879094 #>>41887918 #
10. lelanthran ◴[] No.41876810{3}[source]
> I doubt it was true in 2012, because sysadmins would be the ones trying to make it run reliably, including things like replication, upgrades, etc.

Possibly I got it wrong and switched around which was easier on the devs and which was easier on the sysads?

In my defence, ISTR, when talking to sysads about MySQL vs PostgreSQL, they preferred the latter due to having less to worry about once deployed (MySQL would apparently magically lose data sometimes).

replies(1): >>41877205 #
11. pritambarhate ◴[] No.41877061[source]
My experience has been exactly opposite. Ability to do Vacuums is good. MySQL doesn’t free up space taken by deleted rows. The only option to free up the space is to mysqldump the db and load it again. Not practical in most of the situations.
replies(3): >>41877166 #>>41877653 #>>41878767 #
12. benoitg ◴[] No.41877166[source]
Not really, the innodb_file_per_table variable has been set to 1 for a long time. Running OPTIMIZE TABLE frees up the disk space in this case.
replies(1): >>41877285 #
13. karamanolev ◴[] No.41877205{4}[source]
MyISAM in the olden days could/would magically lose data. InnoDB has been the de facto standard for a while and I haven't seen data loss attributed to it.
14. GoblinSlayer ◴[] No.41877270[source]
>MySQL is easier for developers

Except that search doesn't work, because all text is in latin1 encoding.

replies(3): >>41878001 #>>41878071 #>>41878723 #
15. sudhirj ◴[] No.41877285{3}[source]
Is this process materially different from a vacuum? Does it manage to optimise without a write lock?
replies(2): >>41877689 #>>41878011 #
16. p_l ◴[] No.41877299{4}[source]
Some places still have columns declared as utf8 instead of utf8mb4, and there's a special place in hell for authors of the MySQL general clusterfuck regarding encodings - it was all nice and great if you didn't care about anything other than latin1 or ASCII - go outside that before utf8 option and it was horror that even experienced operators managed to fuckup (I have a badge from a Google conference in 2017 with nicely visible effect of "we have mixed up one of the three separate encoding settings in MySQL and now you have mojibake in your badge").

And then there's UTF8 not actually being UTF8, which can result in total lockup of a table if someone inputs a character that does not fit in UCS-2 and now you need to recover the database from backup and preferably convert all instances of utf8 to utf8mb4, because fuck you that's why.

replies(1): >>41878454 #
17. iamjkt ◴[] No.41877653[source]
Running 'optimize table <table>' reclaims the space on MySQL/MariaDB.
18. benoitg ◴[] No.41877689{4}[source]
I don't know how VACUUM works, I couldn't tell you about the differences.

The OPTIMIZE works almost exclusively with online DDL statements. There's only a brief table lock held during table metadata operations, but I haven't found that to be a problem in practice. (https://dev.mysql.com/doc/refman/8.4/en/optimize-table.html#...)

19. Symbiote ◴[] No.41877978{3}[source]
People are criticising decade-old releases of PostgreSQL, so it seems fair to compare them to similarly aged MySQL releases.
20. williamdclt ◴[] No.41877996[source]
Interestingly, someone else in another comment is arguing the exact opposite!
21. homebrewer ◴[] No.41878001{3}[source]
This was never true if you know what you're doing, and hasn't been true since 2018 even if you don't.
22. homebrewer ◴[] No.41878011{4}[source]
http://rhaas.blogspot.com/2011/02/mysql-vs-postgresql-part-2...
replies(1): >>41886804 #
23. yxhuvud ◴[] No.41878057{3}[source]
In 2012 MySQL had several flavors of replications, each with its own very serious pitfalls that could introduce corruption or loss of data. I saw enough of MySQL replication issues in those days that I wouldn't want to use it.

But sure, it was easy to get a proof of concept working. But when you tried to break it by turning off network and/or machines, then shit broke down in very broken ways that was not recoverable. I'm guessing most that set up MySQL replication didn't actually verify that it worked well when SHTF.

replies(3): >>41878828 #>>41880075 #>>41880546 #
24. yxhuvud ◴[] No.41878071{3}[source]
Either latin1 or that absolutely horrible max-three-byte utf8 encoding that used to be the only available option for utf8.
25. yxhuvud ◴[] No.41878085{3}[source]
MySQL used to have horrible and very unsafe defaults for new installations that persisted well after the introduction of InnoDB. Those went unfixed for a very long time.
26. lol768 ◴[] No.41878454{5}[source]
Yeah, the whole charset/collation design is a complete dumpster fire.
replies(1): >>41878747 #
27. sgarland ◴[] No.41878723{3}[source]
While obviously I prefer Unicode, latin-1 is perfectly acceptable for most use cases in Western cultures.

What part of searching have you found to not work well using it?

replies(1): >>41894259 #
28. sgarland ◴[] No.41878747{6}[source]
In fairness, reasoning about collations is like peering into the abyss. I get why they’re required to have so many levels of detail, and the Unicode Consortium has done a fantastic job, but to say they’re complicated is putting it mildly.
29. sgarland ◴[] No.41878767[source]
VACUUM rarely reclaims space from the OS’ perspective, if that’s what you meant. It can in certain circumstances, but they’re rare. VACUUM FULL is the equivalent to OPTIMIZE TABLE – both lock the table to do a full rewrite, and optimally binpack it to the extent that is posssible.

EDIT: my mistake, OPTIMIZE TABLE is an online DDL. I’ve been burned in the past from foreign key constraint metadata locks essentially turning it into a blocking operation.

30. sofixa ◴[] No.41878828{4}[source]
Maybe that was true in 2012 (maybe it was related to MyISAM) but by ~2015 with InnoDB MySQL replication was rock solid.
replies(1): >>41879698 #
31. justinclift ◴[] No.41879094{5}[source]
Both databases are owned by the same company. Wonder if it's something inherent to the company which has keep that limitation going?
32. yxhuvud ◴[] No.41879698{5}[source]
It was not related to MyISAM.

How did you verify that it was rock solid? And which of the variants did you use?

33. evanelias ◴[] No.41880075{4}[source]
Many of the largest US tech companies were successfully using MySQL replication in 2012 without frequent major issues.

source: direct personal experience.

34. est ◴[] No.41880546{4}[source]
> pitfalls that could introduce corruption or loss of data

sometimes, repairing broken data is easier than, say, upgrading a god damn hot DB.

MVCC is overrated. Not every row in a busy MySQL table is your transactional wallet balance. But to upgrade a DB you have to deal with every field every row every table, and data keeps changing, which is a real headache

Fixing a range of broken data, however, can be done by a junior developer. If you rely on rdbms for a single source of truth you are probably fucked anyway.

btw I do hate DDL changes in MySQL.

35. sudhirj ◴[] No.41886804{5}[source]
That helps a lot thanks. Will summarize it quickly for those who come later: MySQL (InnoDB really) and Postgres both use MVCC, so they write a new row on update. InnoDB however also additionally writes a record marking the old row for deletion.

To do a cleanup, InnoDB uses the records it kept to delete old data, while Postgres must do a scan. So InnoDB pays a record-keeping price as part of the update that makes it easier to clear data, while Postgres decides to pay this price of occasional scanning.

36. tpmoney ◴[] No.41887918{5}[source]
Oracle also didn't support Boolean data types for a long time, and had a 20 some odd year public thread arguing that no one needed a Boolean data type (https://asktom.oracle.com/ords/f?p=100:11:0::::P11_QUESTION_...). They finally added it in Oracle 23 which is nice, but I wouldn't consider it to be in good company to be lacking something Oracle also lacks.
replies(1): >>41889141 #
37. The_Colonel ◴[] No.41889141{6}[source]
Not having a boolean data type is IMHO just an annoyance, not comparable to the lack of transactional DDL.

But to the point, people often use this point to claim that MySQL is a toy database, not usable for real world production use. I use Oracle as a counterpoint, which also has a lot of warts but is pretty much an archetype of an enterprise-grade DB engine.

38. GoblinSlayer ◴[] No.41894259{4}[source]
The catch is that PHP backend passes strings in utf8.