Live data from Hacker News

Ask HN: PostgreSQL or MySQL?

news.ycombinator.com

141–150 of 181 posts

Re: Ask HN: PostgreSQL or MySQL?

#141
post #61

Earlier quoted context omitted.

Too many Open Source developers discount the value of documentation. I all too often hear, "It's Open Source so the community should step up and write the documentation." To which I counter that the best person/people to at least start the documentation are the ones who build the product as they're the most knowledgeable about it. The community will gladly contribute. I personally believe that great documentation was…

Same for all of the GNU software distribution, Sun Microsystems’ products, and SGI’s. Even MSDN has had pretty good documentation. I miss the days when I could understand how something worked just by reading the official documentation first. To this day, in my open source projects, I do not accept contributions that lack either documentation updates or test cases.

> I miss the days when I could understand how something worked just by reading the official documentation first.

This is probably why I don’t read much documentation when I’m working with a library, et al. Never thought about it until I read the parent

Re: Ask HN: PostgreSQL or MySQL?

#142

1. PostgreSQL. Fast, reliable, (relatively) small (for some reason mysql got a lot bigger). Had a few historic problems with replication but I think that's been resolved. I dealt a lot with large scale large data sets and I wouldn't recommend mysql for that at all, except if they were very simple and relations were either not used or used minimally. There are better database systems than either, but I can't think of…

> I dealt a lot with large scale large data sets and I wouldn't recommend mysql for that at all Was your use-case transaction processing (OLTP) or analytics (OLAP)? There are a ton of examples of massive-scale MySQL deployments for OLTP... Facebook, YouTube, Pinterest, Slack, Uber, Wikipedia, GitHub, Yelp, Etsy, Shopify, Booking.com, Wordpress.com, Tumblr, Box, Dropbox, Alibaba, Square, Venmo... a large chunk of the…

It seems most people on HN (and to their credit, they also admit), they have limited recent experience with MySQL, so they don't know that they are 99% functionally equivalent (with edge cases being better for one or the other).

Re: Ask HN: PostgreSQL or MySQL?

#143

Given the progress both Mariadb and postgresql has made I think you will not go wrong with either. In both you have support for json now which one you chose depends on your use case. Mariadb - If you want easy horizontal scalability with master-master replication go with mariadb. Postgresql - If you want reliable and powerful sql-92 compliance and willing to work with master-slave go for postgresql. You can do master…

In my experience, master-master replication with Galera is more troublesome than its worth. It's better to use the simple master-standby solution with automated fail-over.

Re: Ask HN: PostgreSQL or MySQL?

#144
post #125

Materialized views, common table expressions, outer joins, are all missing in mysql and essential. The Postgresql's stored procedure language blows mysql out of the water, and it's possible to use different language backends. SQLite has json extensions. You need to select them at compile time though, so you can't just assume they'll be there by default.

MySQL has supported left/right outer joins for as long as I can remember, and I've been using it continuously since 2003. MySQL doesn't support full outer join , but it's rarely needed, and you can often get a similar result using a UNION. (Clunky, I'll admit... but I'd say the same thing about Postgres recommending against use of NOT IN , which is a common construct and more readable than an anti-join.) CTEs were ad…

> . but I'd say the same thing about Postgres recommending against use of NOT IN, which is a common construct and more readable than an anti-join.

The recommendation against that is due to the semantics defined in the standard. If there is any NULL in the list matched against, the entire a NOT IN (...) expression also has to evaluate to NULL. Which is extremely confusing to most people (and has some consequences in how efficient things can be executed).

Re: Ask HN: PostgreSQL or MySQL?

#145

1. Mostly, Postgres, as it's superior in most areas, but MySQL seems to still have advantages in replication (and, if you are hosting in AWS, there Aurora Serverless MySQL offering supports somethings, like their own Data API, that the equivalent Postgres offering doesn't yet which may tip the balance. > Is it possible to build a hybrid database schema? For example, SQLite+JSON? Yes, but many DBs will hold JSON nativ…

Aurora PG Serverless is out as of July, but I’ve read some horror stories about it so far.

Don't know about horror stories, but Aurora PG Serverless doesn't (yet?) have the Data API support (which enables a couple of other Aurora serverless features) that Aurora MySQL Serverless has, and IIRC has some other feature limitations that aren't directly tied to Data API.

Re: Ask HN: PostgreSQL or MySQL?

#146

Earlier quoted context omitted.

The biggest social network uses MySQL because they already dumped so much engineering into it that changing is basically impractical. But it's mostly used as a key-value store backing a custom graph database.

That is simply not correct. Please understand that I worked on MySQL at Facebook, so I know what I'm talking about here :) Facebook developed an entirely new MySQL storage engine (MyRocks, which is a RocksDB-backed engine for MySQL) and then migrated their largest sharded tiers to it. This is basically just as much work as developing a new database from scratch, i.e. more work than something like migrating to Postgre…

> This is basically just as much work as developing a new database from scratch, i.e. more work than something like migrating to Postgres. This completely debunks the "changing is basically impractical" claim.

I disagree for three reasons:

1. The long tail of code using MySQL at the company, like at any large software company, is prohibitive. You would have to maintain MySQL and PostgreSQL in parallel for years. A new storage engine, on the other hand, is controlled by one team.

2. Migrating from InnoDB to MyRocks consists of successively adding MyRocks replicas, letting them catch up, and removing InnoDB replicas. That is a dramatically easier proposition than migrating tiers to PostgreSQL.

The fact that RocksDB was a hard technical project is kind of irrelevant. The new storage engine provided major wins and could be done within a team, while migrating to PostgreSQL would provide at most small improvements and demand changes to huge amounts of code and massive data migration projects. That makes the former project deeply practical and the latter impractical. If the usual stack back in the day had been the LAPP stack instead of the LAMP stack, we would be having this discussion the other way.

> calling it a "key-value store" is a gross oversimplification at best

That's fair. The right thing to have said would be that the query patterns that are used are extremely simple selects over a single table, which is a place that MySQL has traditionally shone. MySQL's query planner still does strange things on complex queries from time to time. I had a case about six months ago where one shard decided it was going to reorder indexes in a query and load everything in the database's core tables before filtering it down instead of using the proper index order like the other nine hundred something shards. Easily fixed once we realized it (we forced the index order in the query), but the fact that we had to... I have heard that this has all gotten much better in MySQL 8.0.

Re: Ask HN: PostgreSQL or MySQL?

#147

Earlier quoted context omitted.

No. MongoDB has a track record of losing data and not actually providing durability. It is considered a joke in the professional community.

Mongodb's new storage engine was written by Keith Bostic and Dr Michael Cahill. They are database veterans. Wiredtiger is really nicely written.

It's been four years since I looked at it, but WiredTiger didn't replicate atomically under high write rates.

We had a master and replica running on the same machine and we were doing packet capture and inspection writing to the database. Our capture pipeline wrote to the master, and our system queried the replica so we didn't destroy the write rate. We were doing a zero allocation capture pipeline where the pages that the kernel passed back to us were already embedded in the skeleton of a BSON document that we then filled in and finally shoved straight onto the wire to the local Mongo master.

We started seeing records in the replica that were missing fields that were present on the master. These weren't eventual consistency things. Records are supposed to be replicated atomically, and these persisted in the system. We ended up having to run full database scans to find and clean them up.

Mongo claimed they fixed it twice. In neither case was it fixed. We migrated to a different system at that point. Maybe it's all wonderful now, but since MongoDB was a pain to use for other reasons, I have never felt the slightest inclination go back and try it again.

Re: Ask HN: PostgreSQL or MySQL?

#148

Earlier quoted context omitted.

No. MongoDB has a track record of losing data and not actually providing durability. It is considered a joke in the professional community.

interesting: https://www.mongodb.com/jepsen A lot of MongoDB users who wouldn't be considered a "joke" https://www.mongodb.com/who-uses-mongodb Rather than listen to unqualified nonsense, they run tests. And gather facts to guide technology decisions. and yes, I work for MongoDB - just before anyone starts whining about disclosure You're welcome

I posted my problems with it as a response to a sibling comment. Since this was four or five years ago now, maybe all of this has been fixed, but that's not something I'm going to depend on in production any time soon.

Also, the MongoDB users you list must be taken with a grain of salt. For example, you list Facebook on that page. Nope. The description is "...adapted the storage engine API, extending MongoDB into new workloads and new capabilities." That is, Facebook acquired Parse, which used Mongo. Facebook ported MongoDB to run on RocksDB. Facebook shut down Parse. End of MongoDB at Facebook. You list Google, and the mouseover is basically that you can run MongoDB on GCE. I'm not saying that Mongo is unusual in this behavior. It's how most people listing "who uses X" build their lists.

Re: Ask HN: PostgreSQL or MySQL?

#149
Although there is already pretty unanimous consensus here, one side note is that administrating mysql is always a headache in my experience whereas postgres seems to just work.

Every time I start a new project and I see it's using mysql i sigh a little bit knowing that I'm going to end up spending hours fighting some dumb configuration issue.

Re: Ask HN: PostgreSQL or MySQL?

#150

Earlier quoted context omitted.

Aurora PG Serverless is out as of July, but I’ve read some horror stories about it so far.

Interesting. Do you have any links or further info? Evaluating setting up a standard PG RDS instance or going Aurora PG Serverless.

https://news.ycombinator.com/item?id=20398353
Post reply on HN