News for hackers. Stuff that matters.
Re:Why Does Everyone Run Ancient Postgres Versions? by slotrans on Friday October 18, 2024 @12:00AM (#41876232)
"Not as robust as MySQL"? Surely you're joking.
Re:Why Does Everyone Run Ancient Postgres Versions? by sgarland on Friday October 18, 2024 @12:20AM (#41876309)
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.

Re:Why Does Everyone Run Ancient Postgres Versions? by lelanthran on Friday October 18, 2024 @01:43AM (#41876650)
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.

Re:Why Does Everyone Run Ancient Postgres Versions? by GoblinSlayer on Friday October 18, 2024 @04:01AM (#41877270)
>MySQL is easier for developers

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

Re:Why Does Everyone Run Ancient Postgres Versions? by homebrewer on Friday October 18, 2024 @06:28AM (#41878001)
This was never true if you know what you're doing, and hasn't been true since 2018 even if you don't.
Re:Why Does Everyone Run Ancient Postgres Versions? by yxhuvud on Friday October 18, 2024 @06:37AM (#41878071)
Either latin1 or that absolutely horrible max-three-byte utf8 encoding that used to be the only available option for utf8.
Re:Why Does Everyone Run Ancient Postgres Versions? by sgarland on Friday October 18, 2024 @08:21AM (#41878723)
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?

Re:Why Does Everyone Run Ancient Postgres Versions? by GoblinSlayer on Sunday October 20, 2024 @05:48AM (#41894259)
The catch is that PHP backend passes strings in utf8.
Re:Why Does Everyone Run Ancient Postgres Versions? by sofixa on Friday October 18, 2024 @02:20AM (#41876791)
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).

Re:Why Does Everyone Run Ancient Postgres Versions? by lelanthran on Friday October 18, 2024 @02:23AM (#41876810)
> 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).

Re:Why Does Everyone Run Ancient Postgres Versions? by karamanolev on Friday October 18, 2024 @03:49AM (#41877205)
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.
Re:Why Does Everyone Run Ancient Postgres Versions? by yxhuvud on Friday October 18, 2024 @06:35AM (#41878057)
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.

Re:Why Does Everyone Run Ancient Postgres Versions? by sofixa on Friday October 18, 2024 @08:34AM (#41878828)
Maybe that was true in 2012 (maybe it was related to MyISAM) but by ~2015 with InnoDB MySQL replication was rock solid.
Re:Why Does Everyone Run Ancient Postgres Versions? by yxhuvud on Friday October 18, 2024 @10:16AM (#41879698)
It was not related to MyISAM.

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

Re:Why Does Everyone Run Ancient Postgres Versions? by evanelias on Friday October 18, 2024 @11:03AM (#41880075)
Many of the largest US tech companies were successfully using MySQL replication in 2012 without frequent major issues.

source: direct personal experience.

Re:Why Does Everyone Run Ancient Postgres Versions? by est on Friday October 18, 2024 @11:51AM (#41880546)
> 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.

Re:Why Does Everyone Run Ancient Postgres Versions? by williamdclt on Friday October 18, 2024 @06:27AM (#41877996)
Interestingly, someone else in another comment is arguing the exact opposite!
Re:Why Does Everyone Run Ancient Postgres Versions? by wbl on Friday October 18, 2024 @12:39AM (#41876387)
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.
Re:Why Does Everyone Run Ancient Postgres Versions? by maxk42 on Friday October 18, 2024 @02:09AM (#41876737)
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.

Re:Why Does Everyone Run Ancient Postgres Versions? by Symbiote on Friday October 18, 2024 @06:25AM (#41877978)
People are criticising decade-old releases of PostgreSQL, so it seems fair to compare them to similarly aged MySQL releases.
Re:Why Does Everyone Run Ancient Postgres Versions? by yxhuvud on Friday October 18, 2024 @06:38AM (#41878085)
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.
Re:Why Does Everyone Run Ancient Postgres Versions? by SavageBeast on Friday October 18, 2024 @01:28AM (#41876576)
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

Re:Why Does Everyone Run Ancient Postgres Versions? by o11c on Friday October 18, 2024 @02:01AM (#41876711)
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.

Re:Why Does Everyone Run Ancient Postgres Versions? by p_l on Friday October 18, 2024 @04:05AM (#41877299)
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.

Re:Why Does Everyone Run Ancient Postgres Versions? by lol768 on Friday October 18, 2024 @07:44AM (#41878454)
Yeah, the whole charset/collation design is a complete dumpster fire.
Re:Why Does Everyone Run Ancient Postgres Versions? by sgarland on Friday October 18, 2024 @08:23AM (#41878747)
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.
Re:Why Does Everyone Run Ancient Postgres Versions? by The_Colonel on Friday October 18, 2024 @02:21AM (#41876795)
Lack of transactional DDL is certainly painful, but not unique for MySQL. Oracle doesn't support it either.
Re:Why Does Everyone Run Ancient Postgres Versions? by justinclift on Friday October 18, 2024 @09:08AM (#41879094)
Both databases are owned by the same company. Wonder if it's something inherent to the company which has keep that limitation going?
Re:Why Does Everyone Run Ancient Postgres Versions? by tpmoney on Saturday October 19, 2024 @10:22AM (#41887918)
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.
Re:Why Does Everyone Run Ancient Postgres Versions? by The_Colonel on Saturday October 19, 2024 @01:27PM (#41889141)
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.

Re:Why Does Everyone Run Ancient Postgres Versions? by elisbce on Friday October 18, 2024 @02:14AM (#41876762)
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.
Re:Why Does Everyone Run Ancient Postgres Versions? by pritambarhate on Friday October 18, 2024 @03:19AM (#41877061)
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.
Re:Why Does Everyone Run Ancient Postgres Versions? by benoitg on Friday October 18, 2024 @03:42AM (#41877166)
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.
Re:Why Does Everyone Run Ancient Postgres Versions? by sudhirj on Friday October 18, 2024 @04:03AM (#41877285)
Is this process materially different from a vacuum? Does it manage to optimise without a write lock?
Re:Why Does Everyone Run Ancient Postgres Versions? by benoitg on Friday October 18, 2024 @05:28AM (#41877689)
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#...)

Re:Why Does Everyone Run Ancient Postgres Versions? by homebrewer on Friday October 18, 2024 @06:29AM (#41878011)
Re:Why Does Everyone Run Ancient Postgres Versions? by sudhirj on Saturday October 19, 2024 @05:49AM (#41886804)
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.

Re:Why Does Everyone Run Ancient Postgres Versions? by iamjkt on Friday October 18, 2024 @05:21AM (#41877653)
Running 'optimize table <table>' reclaims the space on MySQL/MariaDB.
Re:Why Does Everyone Run Ancient Postgres Versions? by sgarland on Friday October 18, 2024 @08:26AM (#41878767)
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.

Re:Why Does Everyone Run Ancient Postgres Versions? by erik_seaberg on Friday October 18, 2024 @12:38AM (#41876384)
Early MySQL versions made egregious design choices like quietly ignoring missing foreign keys and enum typos, truncating long strings, and randomly choosing rows from groups.

https://web.archive.org/web/20230922210124/https://grimoire....

Re:Why Does Everyone Run Ancient Postgres Versions? by sgarland on Friday October 18, 2024 @08:34AM (#41878819)
Yeah, it was bad. What kills me is SQLite has its own absurd set of gotchas [0] yet is seen as amazing and wonderful by devs. PKs can have NULLs? Sure! Strings can have \0 in the middle of them? Why not? FKs aren’t enforced by default? Yeah, who needs referential integrity, anyway?

My only conclusion is that the majority of devs don’t actually read documentation, and rely purely on the last blog post they read to influence their infrastructure decisions.

[0]: https://www.sqlite.org/quirks.html

Re:Why Does Everyone Run Ancient Postgres Versions? by hu3 on Friday October 18, 2024 @12:06PM (#41880696)
Understanding and memorizing shortcomings and quirks takes time and effort.

Most devs just go with whatever the influencer du jour says is good.

"Nobody ever got fired for choosing insert_currently_hyped_tech_here"

Re:Why Does Everyone Run Ancient Postgres Versions? by Propelloni on Friday October 18, 2024 @03:36AM (#41877139)
It is hard to live down a reputation ;)

MySQL was immortalized as the database in every LAMP stack. And just like PHP it improved considerably since then.

Re:Why Does Everyone Run Ancient Postgres Versions? by p_l on Friday October 18, 2024 @04:06AM (#41877303)
Also for licensing reasons for a long time there was surviving contingent of MySQL 3.23 in LAMP hosting.
Re:Why Does Everyone Run Ancient Postgres Versions? by johannes1234321 on Friday October 18, 2024 @08:43AM (#41878895)
While that change from LGPL to GPL affected only the client library (server always was GPL(+commercial)) and the MySQL company relatively quickly reacted with a FOSS exception to the GPL and by providing a reimplementation of the client library under PHP license (mysqlnd) to serve that market.

(I joined MySQL shortly after that mess, before the Sun acquisition)

Re:Why Does Everyone Run Ancient Postgres Versions? by p_l on Friday October 18, 2024 @11:57AM (#41880610)
Random hosting providers that were major place for having your baby steps on LAMP stack didn't necessarily grok licensing much
Re:Why Does Everyone Run Ancient Postgres Versions? by johannes1234321 on Friday October 18, 2024 @07:04PM (#41884281)
They also didn't like updating software - to likely that update to PHP or MySQL or something broke some bad script by a customer, who'd complain to the host.
Re:Why Does Everyone Run Ancient Postgres Versions? by slotrans on Wednesday October 23, 2024 @02:33PM (#41927974)
It is funny reading the replies here.

I am a database specialist and have worn the DBA had for many years. I have run MySQL and Postgres in production, both self-hosted and using managed services. Postgres wins on every single dimension that matters, every time. Yes MySQL is easier to setup for non-experts. That counts for nothing.

If you are sticking up for MySQL in this thread... I just don't even know, man.