If that’s not your interest, I will admit that Postgres array support is far ahead of any of the MySQLs. Most ORMs don’t use it but you can get optimal query prefetching via array subqueries.
Ask HN: It's 2023, how do you choose between MySQL and Postgres?
261–270 of 366 posts
Re: Ask HN: It's 2023, how do you choose between MySQL and Postgres?
#262Earlier quoted context omitted.
> It's less featureful, and I'd consider that a strong virtue in the YAGNI camp - less to go wrong, less mental overhead. This doesn't really hold water in my opinion. It's not like PostgreSQL is some minefield of misfeatures and quirky behavior. Some of these features exist , but have zero impact on you unless you actually opt to use them. But if you end up needing to: they're there, and you can just start using the…
Your examples regarding MySQL's features are not correct. Need to apply an index to the result of a function? No problem, use a functional index, supported since October 2018: https://dev.mysql.com/doc/refman/8.0/en/create-index.html#cr... Need to use a window function? No problem, supported since April 2018: https://dev.mysql.com/doc/refman/8.0/en/window-functions.htm...
There are far more examples than just those two though. :)
Re: Ask HN: It's 2023, how do you choose between MySQL and Postgres?
#263I’m going to go for the esoteric opinion: MariaDB. Specifically to get system versioned tables. Imagine having the full change history of every single row for any odd task that you need without the performance penalty of keeping historical data in the same table. It can be a huge amount of leverage. If that’s not your interest, I will admit that Postgres array support is far ahead of any of the MySQLs. Most ORMs don’…
Re: Ask HN: It's 2023, how do you choose between MySQL and Postgres?
#264Re: Ask HN: It's 2023, how do you choose between MySQL and Postgres?
#265Earlier quoted context omitted.
> doing a tolower() on every db search and not use indices If you create the index with lower() it will uses that; e.g. "create index on tbl (lower(email))" and then "select * from tbl where lower(email)=lower($1)". That's more or less the standard way to do this but there are some other ways as well. It's more explicit than MySQL, so in that way it's better. It's more effort and easy to forget, and in that way it's…
> It's more explicit than MySQL, so in that way it's better. It sounds like you're under the impression that MySQL just makes everything case-insensitive and is silent about this? That's decidedly not the case. MySQL 8 ships with 41 different character sets, supporting a total of 286 different collations. Collation names explicitly include "ci" (case-insensitive) vs "cs" (case-sensitive), as well as "ai" (accent-inse…
Re: Ask HN: It's 2023, how do you choose between MySQL and Postgres?
#266Earlier quoted context omitted.
> I forget if there's an equivalent for the first one Not really; PostgreSQL doesn't store the original query, so you'll need to re-create it from pg_class, pg_attribute, and all of that (which is really what \d and such in psql do). The easiest way is probably pg_dump, but it's best to just get used to \-commands because it's really just the same thing.
Find the SQL from meta commands. Example: https://dba.stackexchange.com/a/131031
Re: Ask HN: It's 2023, how do you choose between MySQL and Postgres?
#267Earlier quoted context omitted.
> It's more explicit than MySQL, so in that way it's better. It sounds like you're under the impression that MySQL just makes everything case-insensitive and is silent about this? That's decidedly not the case. MySQL 8 ships with 41 different character sets, supporting a total of 286 different collations. Collation names explicitly include "ci" (case-insensitive) vs "cs" (case-sensitive), as well as "ai" (accent-inse…
There is no way to see from the query itself if it's case-sensitive or insensitive; that is what I meant.
Besides, MySQL also supports functional indexes, so you could do the (lower(email)) approach in MySQL too if you really want!
Re: Ask HN: It's 2023, how do you choose between MySQL and Postgres?
#268Earlier quoted context omitted.
Your examples regarding MySQL's features are not correct. Need to apply an index to the result of a function? No problem, use a functional index, supported since October 2018: https://dev.mysql.com/doc/refman/8.0/en/create-index.html#cr... Need to use a window function? No problem, supported since April 2018: https://dev.mysql.com/doc/refman/8.0/en/window-functions.htm...
Fair. I picked two instances that had long been personally painful with MySQL and didn’t exist when I finally fled to greener pastures. There are far more examples than just those two though. :)
There's no silver bullets in software or databases, no "one size fits all". Just various trade-offs between different design decisions.
Re: Ask HN: It's 2023, how do you choose between MySQL and Postgres?
#269There is almost no good reason to choose MySQL over PostgreSQL for any operational reason, I did a deep dive many moons ago (before major improvements in performance to postgres) and people were saying that MySQL was faster. I found that not to be true and the differences have only gained even more favour towards postgres. also, I assume you mean MariaDB as MySQL is owned by Oracle and I would greatly implore anyone…
> There is almost no good reason to choose MySQL over PostgreSQL for any operational reason Galera is the main one I can think of: * https://galeracluster.com/library/documentation/tech-desc-in... * https://mariadb.com/kb/en/what-is-mariadb-galera-cluster/ * https://packages.debian.org/search?keywords=galera I'm not aware of any multi-master, active-active(-active) replication system that is open source for PostgreSQ…
In the Postgres space there is citusdb which provides multi master.
There is also BDR from 2ndquadrant if you want a paid/supported solution. https://www.enterprisedb.com/products/edb-postgres-distribut...
Re: Ask HN: It's 2023, how do you choose between MySQL and Postgres?
#270The main reason I prefer mysql over PostgreSQL is that mysql is just more consistent - in its commands, quirks, etc. Postgres - is it pg, pgsql, psql, postgres, postgresQL? The answer is "yes." Plus the case behavior for tables and column names drives me crazy. It's like some leftover VMS shit. I mean seriously fix it. Can you or can you not use a capital letter for a table/column name? I can never remember. Or you c…
What exactly do you mean with this? I tried to find some more information, and all I could find were some fixes from 2001[1] (SunOS 4 was supported until 2003), a minor refactor in 2008 with "SunOS 4 is probably broken anyway"[2], and that's pretty much it. SunOS 4 was moved to "Unsupported Platforms" with the release of 7.3, in 2002.[3]
[1]: https://postgrespro.com/list/thread-id/1598869
[2]: https://www.postgresql.org/message-id/20081211091708.0726075...
[3]: https://www.postgresql.org/docs/7.3/supported-platforms.html