Live data from Hacker News

Ask HN: PostgreSQL or MySQL?

news.ycombinator.com

151–160 of 181 posts

Re: Ask HN: PostgreSQL or MySQL?

#151

Earlier quoted context omitted.

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 ne…

You're severely underestimating the amount of effort that went into MyRocks. The development and deployment was a 3+ year effort spanning quite a few different teams.

Automating the physical rollout (as you correctly described) is the easy part. That doesn't account for all the many difficult spots that occurred prior to it: the massive complexity of mysql storage engine development in general; huge numbers of various performance edge-cases; converting replication-related system tables to MyRocks in order to achieve crash-safe replication; developing online hot-copy for MyRocks from scratch; schema change support; adding tons of new status vars and system vars; fast bulk import to MyRocks which is necessary for the replica migration to even be possible; updating hundreds of thousands of lines of automation code written under the assumption of InnoDB being the only storage engine in use and using various InnoDBisms...

The MyRocks migration wasn't a project I personally worked on, but I'm very aware of what was involved. It appears you joined FB PE in 2017 and therefore missed much of this historical context? I'm not really sure why you would have such strong opinions about it.

You say that FB is using MySQL because "changing is basically impractical", but also say MyRocks "provided major wins", which seems to be a contradiction. In any case, I'm not aware of any pg feature that provides compression ratios anywhere near that of MyRocks, and pg is only recently even adopting an arch that supports pluggable storage engines at all. In combination it's really hard to make a case that FB is using MySQL just due to historical investment and inability to change.

Honestly I would also not be surprised if FB moves some core tiers off of MySQL to a pure-RocksDB solution at some point in the future. The number of intermediate data services and proxies make this sort of thing absolutely possible. For the same reason, in theory a move to another db like pg would be completely possible without needing to run both in parallel for years (again, just talking in theory; moving to pg just doesn't make practical sense).

> The right thing to have said would be that the query patterns that are used are extremely simple selects over a single table

For UDB, sure. What about all the other MySQL tiers? The non-UDB MySQL footprint at FB, despite being a minority of FB's MySQL fleet, is still larger than the vast majority of other companies' relational database fleets worldwide. The range of use-cases in the DBaaS (XDB) tier alone spans a massive combination of different database features and access patterns.

Re: Ask HN: PostgreSQL or MySQL?

#152

Earlier quoted context omitted.

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 th…

Well technically wiredtiger is not in charge of the replication.

Re: Ask HN: PostgreSQL or MySQL?

#153
Thank you all, I've tried to read all the comments. I think I have to clarify the questions I asked:

1. Is related to our upcoming startup, we chose MySQL + Redis, but some said use PostgreSQL

(However, my friend explained that MySQL before v8 was weak and after v8 has tried to come back to its salad days, this is why he chose MySQL)

2-3-4: In the industry, especially in the industry I'm active, Digital Built Environment Industry, there's a lot of invaluable schemas, especially XML(XMI) that I feel "these schemas convert structured data to semi-structured data" which is not good and efficient

For this reason, I'm thinking of SQL (Server) and SQLite (File) to preserve structured data

There's a vitally important schema in the built environment industry called Industry Foundation Classes (IFC) [1] which is based on EXPRESS/STEP and also has XML(XMI) schema too, but I want to convert the schema to SQL and SQLite

A friend did an invaluable job and after years introduced a correct method to convert it to SQL [2][3] but don't have any idea of developing the schema based on SQLite [4] that will accelerate the IFC development

[1] https://www.buildingsmart.org/about/what-is-openbim/ifc-intr...

[2] https://forums.buildingsmart.org/t/ifc-for-relational-databa...

[3] https://forums.buildingsmart.org/t/store-modify-and-retrieve...

[4] https://forums.buildingsmart.org/t/ifc-sqlite-project/1359

Re: Ask HN: PostgreSQL or MySQL?

#154
post #6

The following isn’t the top reason I recommend Postgres, but is the reason I think least likely to be echoed in a dozen other comments: Postgres has some of the best documentation of any software product I’ve ever used. If someone wants to learn about SQL or databases, I always have to restrain myself from recommending that they just read the Postgres manual front to back. It’s comprehensive, it’s well written, it’s…

It may have a good doc but searchability on the internet is still miles behind MySQL and that actually counts more on daily search for answers.

Also I sometimes don't know if I should search with psql or pgsql or postgres or postgresql and I tend to type shorter ones but mysql is quite obvious on that.

Re: Ask HN: PostgreSQL or MySQL?

#155

On the first point, default to using Postgres unless you have a particular reason not to. In general, it offers more and better-executed features. There are some scenarios where MySQL offers a benefit and this advice doesn’t apply, but it’s unlikely you will need to worry about that if you’re in a “what database do I use” position. Your other questions are a bit too vague to be answerable. It’s possible to build anyt…

I'd say, use MySQL 8 unless you have a particular reason not to. You get more resource online when you search around and toolings are better and those are as important as features to many and I doubt MySQL 8 lacks much for most people's use cases.

Re: Ask HN: PostgreSQL or MySQL?

#156

Is there a Galera-equivalent system available of Postgres? I.e., multi-master replication. I know of BDR, but that doesn't seem to be publicly available for recent versions of Pg?

Not sure about master-master, but I've used repmgr[1] to manage a PostgreSQL master-slave setup and it works pretty well though it is by no-means plug and play. There are a variety of steps and manual processes to get it up and running. [1] https://repmgr.org/

We find it handy to have multi-master, which leans towards being more active-active: we have keepalived doing health checks on two systems, and point our app server(s) at a vIP.

The app server runs Galera's arbd so we don't need three DBs.

Re: Ask HN: PostgreSQL or MySQL?

#158

Earlier quoted context omitted.

As someone who has transitioned from MySQL->pg, this makes total sense to me. Partitioning is still a bit better in MySQL IMO (many types / options) - but pg is nearly there.

Did you mean replication rather than partitioning perhaps? I've found MySQL replication quite easy to use, whereas PostgreSQL has been rather clunkier in my experience. However, I've had the exact opposite experience with respect to partitioning.

No. I was referring to table partitioning.

I don't have much experience with replication in either MySQL or PG (but understand this is another area where mysql may edge pg out still).

Re: Ask HN: PostgreSQL or MySQL?

#159
Question on this area. What have you found to be the best way to migrate an existing app to Postgres?

We plan to migrate to Postgres, but with every LOC written we're entrenching ourselves into Mysql. We all want Postgres, but at the same time I just can't see the transition happening with each passing day.

Thoughts?

edit: I should be clear too. I think our goal would be to not require a full rewrite spanning weeks. So an active translation layer, or replication.. or something tricky.. but I just don't foresee us being able to spend a month putting everything on hold so we can migrate.

Re: Ask HN: PostgreSQL or MySQL?

#160
post #45
post #16

For me postgresql's schema, EXPLAIN, Column modification and UUID. But most of the time I stick to sqlite, it satisfies most of the project with low footprint and require for installation restricted servers.

Every time I've used sqlite for any kind of throwaway web app, I've regretted it due to the almost complete lack of support for concurrent operations. Sqlite is for file formats, not anything that might have concurrent writes.

TIL. I really thought SQLite had better support for concurrent behavior.

Do you know if the problem you cite is distinct separate processes of SQLite? Ie, can a single process (aka one web app) handle concurrent behavior properly with SQLite? Or will it fail even in that scenario?

Post reply on HN