Live data from Hacker News

Ask HN: PostgreSQL or MySQL?

news.ycombinator.com

91–100 of 181 posts

Re: Ask HN: PostgreSQL or MySQL?

#92
post #64

Earlier quoted context omitted.

Fair, but why comment on MySQL's supposed deficiencies if your knowledge of it is so out-of-date?

But vanilla PG didn't get good master / slave feature until "recently" so you were running without replicas in the last 10 years? https://www.postgresql.org/about/news/1235/

Your link is from 9 years ago.

Re: Ask HN: PostgreSQL or MySQL?

#93

Earlier quoted context omitted.

Based on what I have read, "kv store" is a major over-simplification. A number of companies have built special-case storage services/APIs on top of MySQL. This is not the same thing as writing your own database. In any case, it shows the strength and stability of MySQL for high-volume OLTP use-cases. Also I don't think "very long running transactions" were the singular core of Uber's problem. InnoDB MVCC doesn't hand…

> InnoDB MVCC doesn't handle those well either; a long-running tx blocks the purge thread and causes a pile-up of old row versions. Remember that what they moved to isn't directly MySQL eitger, but only uses it underneath.

It's still MySQL/InnoDB under the hood. I don't follow your point -- why does it matter whether an application is talking directly to MySQL, vs using an intermediate service with a non-SQL API? If the intermediate service supports long-running transactions, you'll hit the same underlying issue regardless...

If your point is that they also happened to move to a new access pattern that eliminated long-running transactions, and conflated that access pattern change with their migration off of pg, that's a fair criticism if true. Hopefully someone from Uber can clarify this aspect.

Also from what I recall (been a while since I read Uber's posts about this), Uber's specific MVCC issues related to pg's use of physical replication and locking impact on MVCC; and also separately its storage of old row versions "inline" vs InnoDB's use of a separate undo log. And on a different point, I remember some aspects of InnoDB's clustered index design being advantageous to Uber's workload as well. In total, this is why I suspect simple "long-running transactions" alone were not the primary/singular reason for the switch (at least if "long" means "minutes or hours" in order to negatively affect InnoDB).

Re: Ask HN: PostgreSQL or MySQL?

#95
post #61
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…

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.

Re: Ask HN: PostgreSQL or MySQL?

#96
> 2. Is it possible to build a hybrid database schema? For example, SQLite+JSON?

Postgres and MySQL both have JSON support that can do fancy things which includes indexes, but it's extra work and I don't think it actually gains you anything. I'd recommend using regular old columns for anything you ever plan to want a query on. But if you have other stuff, it's perfectly reasonable to dump a bunch of random garbage into a JSON column. People use this for things like user settings, and are generally happy with it.

> 4. Is it possible to build a custom file format based on SQLite or hybrid one based on SQLite+JSON?

SQLite is already basically a file format. You can store JSON blobs in strings somewhere inside it if that's convenient.

Re: Ask HN: PostgreSQL or MySQL?

#97
post #35

Earlier quoted context omitted.

No one has been using MyISAM for the last 10 years.

Unfortunately this is not true, I found it used in the most unexpected places, even new developments as old as 2-3 years.

That's mostly because it's the default in some versions and the developers don't know/care that MyISAM is dangerous (as it's not transactional and it will transparently ignore any kind of foreign key statement).

Re: Ask HN: PostgreSQL or MySQL?

#98

I will respond only to Q1, taking the perspective of analytics and data science. Answer: PostgreSQL > MySQL Postgres implementation of SQL includes a few useful clauses that are useful for analytics that MySQL does not support. It used to be that MySQL had no window functions, and that made it wholly inferior to Postgres when it came to analytics. However, it seems MySQL began supporting window functions two years ag…

Having consulted for hundreds of analysts writing SQL to explore their data and create reports, I would agree with this assessment. Additionally, I tend to avoid recommending MySQL because of a strange behavior when using Group By. In Postgres, every column must be either aggregated or grouped by when using a grouping expression. In MySQL, this requirement is not present, and the ambiguity of the query is resolved by returning basically random results which are quite often misunderstood to represent the desired report. In other words, you can screw up in MySQL easily and not notice, whereas in Postgres, you’ll get an error message.

https://stackoverflow.com/questions/1023347/mysql-selecting-...

Re: Ask HN: PostgreSQL or MySQL?

#99
My company recently looked at MySQL vs PostgreSQL. While we chose Postgres there is one thing that stood out in my research, I haven't found any comments on this:

We were looking at scalable, HA, possibly multi-DC workloads and such, and yes, relational DBs are not necessarily the right choice, but MySQL looked a bit better in this regard, especially for master-master replication. There are several high-profile teams that have huge production deployments running on MySQL (IIRC Uber and Github) and there are a lot of things to be learned from them.

Re: Ask HN: PostgreSQL or MySQL?

#100

1. For small databases (up to a few GB) my personal preference in the past 5 years was MS SQL (Express Edition, free), then PostgreSQL and last is MySQL. That means the answer to your specific question, PostgreSQL. Why? That is the order of features, ease of use and performance in my experience, other people may have seen different. For larger databases I have no experience with either PostgreSQL or MySQL, I was spoi…

MS SQL Server definitely has some important features that are missing from PG. Top on that list IMO is real stored procedures that can return multiple heterogeneous result-sets with simple select statements. Another big one is client side tools. Query optimization and schema flexibility (being able to alter things instead of dropping in re-creating) might still be not as good in PG as well.

You won’t get a ton of agreement from this crowd though, despite the majority of them probably never having used it.

Post reply on HN