Live data from Hacker News

Ask HN: PostgreSQL or MySQL?

news.ycombinator.com

41–50 of 181 posts

Re: Ask HN: PostgreSQL or MySQL?

#41
post #29

You don't really benefit from MySQL speed if you are not Facebook, so I would always start with PostgreSQL.

We use PostgreSQL but also Firebird, which maybe is the great underdog in opensource databases.

I used InterBase (Firebird predecessor) 15 years ago, and recall it had some big limits around versioning/lots of updates. To reclaim disk space we’d have to periodically backup/restore the db. It got so bad/frequent that we moved to Postgres and haven’t looked back since. I guess if one is considering SQLite that it’s not too relevant, but is this still an issue with modern Firebird?

Re: Ask HN: PostgreSQL or MySQL?

#42

I would also recommend Postgres for the features alone. Like the full text search. One reason not mentioned often is the vast amount of plugins which can do lots of useful things. Like PostGis or TimescaleDb which all work really well.

Instead of requiring a plugin, MySQL has good GIS support natively built-in.

Re: Ask HN: PostgreSQL or MySQL?

#43
If you ask this at HN most likely it will be PostgreSQL.

If you ask scripting language it got to be python or javascript here.

I use HN daily and noticed as a group, HN readers do in general have their preference on things like this.

By all means, MySQL's market share is much larger than PostgreSQL, and MySQL 8+ is very impressive. I compared both and eventually picked MySQL for my projects, even though I really _hate_ Oracle.

Re: Ask HN: PostgreSQL or MySQL?

#44
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…

My pet peeve is great software with incomplete documentation.

All that hard work put into the code, just give us a quick example of how to actually use it! Especially where there is maybe a super superficial example, but missing examples of how to use the optional yet essential and non-straight forward arguments/features.

Re: Ask HN: PostgreSQL or MySQL?

#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.

Re: Ask HN: PostgreSQL or MySQL?

#46

MySQL is simply garbage that shouldn't be used under any circumstance. 1. No transactional DDL 2. Implicit, confusing coercions 3. Terrible Unicode handling 4. the list goes on

1. Thanks to the new data dictionary in 8.0 there is light at the end of that tunnel ...

2. Yeah, MySQL tried to be "simple" and it took a while to be confident for changing it's default to being strict (the option for opting exists for ages ...) But meanwhile defaults are proper.

3. Especially the 3 byte Unicode type was a historic mistake. It reduced required storage space but didn't forsee the need for Emojis and other 4 byte sequences ... utf8mb4 charset fixes that though

4. ...

Re: Ask HN: PostgreSQL or MySQL?

#47
post #11

EXPLAIN is almost useless on mysql, but very helpful in postgres. EXPLAIN is a very useful command once you have some degree of success (users).

MySQL's tabular explain is largely understandable once you also understand how simple its optimizer and execution mechanism is. All you mostly need to look at is the join order and indexes used, and whether there's a filesort in there, and then it's clear enough.

The linear list of steps doesn't work well for a smarter engine.

Re: Ask HN: PostgreSQL or MySQL?

#48
post #30
post #13

Earlier quoted context omitted.

To be fair, often you don't have your requirements completely nailed beforehand, or they change midway through the project. That's why I choose Postgres: aside from extreme scale or latency, you can throw pretty much anything at it. Also, given expert advice, its performance degrades gracefully i.e. lots of easy ways to optimize and workaround issues. Example: pg's type system is insanely flexible incl native support…

If the requirements are still up in the air, then I would aim to use the simplest, most evolvable solution. This to me means no database.

If the requirements are still up in the air, but you know that you're going to be storing some data, definitely go with a database, even if just a single SQLite file. Using plain files means figuring out the file format, which turns into a huge mess when requirements get tacked on later. The other option would be to store a JSON file or a bunch of JSON files in a directory, at which point you're building a shitty version of either SQL or MongoDB instead of focusing on your business logic.

Re: Ask HN: PostgreSQL or MySQL?

#49
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 natively and, conversely, lots of DB data fits nicely in JSON. What's the motivating use case?

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

Not sure what you are asking here; SQLite has its own file format.i suppose, as with many combined formats these days, you could stop that together with a folder of JSON documents and call it a custom format. What's the motivating use case?

Re: Ask HN: PostgreSQL or MySQL?

#50
post #37
post #35

Earlier quoted context omitted.

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

Funnily enough, I have not been using MySQL for the last 10 years either, because I switched to Postgres and never went back.

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