Hacker News new | ask | show | jobs
by bufferoverflow 2994 days ago
Can you demonstrate that Postgre is significantly faster than MySQL on average? Highly doubt so. The problem is in the way data model was architected and implemented.
3 comments

PG isn't usually faster than MySQL on any naive database (which is 90% of database in the world I suppose)

Most E-Shops will be fine running MySQL or MariaDB.

The one thing PG excels at however is that you can tune it much more to your workload and it allows tuning the workload much more finely than MySQL/MariaDB. That and the ability to extend PG arbitrarily (try adding native functions to mysql without recompiling) via the C-FFI offered. You can write and define your own index methods that let you use an index that is perfect for the workload or you can add a new data type to support a new input with validation.

You can sink a lot of work into getting the most out of a PG database, MySQL not so much. But again, for most people MySQL will provide the same (or even better) performance than PG. (I still trust PG over MySQL after MySQL nulled out all entries of a table with only NOTNULL columns after a nasty crash)

Postgresql is different not because it is fast but because it works. And keeps working.
apples to oranges. you need to compare PostgreSQL with other database that don't take shortcut around ACID for performances (for example DDL forcing implicit commit in transactions)
So this is true, but I find that it does not matter much.

Like, how often one needs to rollback a DDL statement? I did that like... never.

And, what is the use case? Like, you added a column to a table by accident? Well, that will not break anything, so no harm done.

That is way different from regular dml rollback which may recover 1bn records and save your life :)

Seriously? You don't need to do DLL operations in day-to-day use but you'll need to when you're doing development work.

For example, you had a "color" column on a table, for a new feature youre now adding the ability to have multiple colors. You're going to create a new column, create a new table, populate that table, and drop the old column. If anything fails during that process you'd like to be able to roll back.

Good points, I am familiar with the process.

There is a concept or "forward-compatible change". Basically, you don't do things that will break your software.

Example, you don't add a NOT-NULL column unless you can give it a good DEFAULT value, to make it work.

Also dont' drop columns until the software is ready for it, etc.

If you have a decent ORM, it will compare your "how it needs to be" sql schema with the "how it is" schema. Then it will generate appropriate "ALTER TABLE ...." "CREATE INDEX " etc statements. Note that this is automated and you never need to type SQL statements to achieve that.

All together in the last XXX years, I did not really need to do a rollback on a dml statement.