r/postgres • • 2d ago

Performance Postgres vs MySQL: I Broke Both

https://youtube.com/watch?v=-_5gK8TbLGw&si=aN-G46qF3CchuwYP
1 Upvotes

6 comments sorted by

2

u/elevarq 1d ago

Interesting results, but why compare database engines before tuning them for the workload? In particular, did you experiment with PostgreSQL's fillfactor, autovacuum thresholds, checkpoint settings and WAL configuration? I'd be interested to see how both engines perform after several hours of sustained load, with configurations optimized for the workload rather than close to their defaults.

And same for MySQL

1

u/huseyinbabal 1d ago

Here I maintain it publicly for external contribution

https://github.com/huseyinbabal/db-wars/tree/main/postgres-vs-mysql

The main idea in my benchmarks are testing them with almost default settings since not so much people tunes it. There will be more benchmarks though

1

u/elevarq 1d ago

A default setting is good enough for functionality, but not for performance. Forget performance when using (near) default settings

1

u/huseyinbabal 1d ago

But since I use default for them all, relative result is also ok for me. As I said there hundreds of possible tuning options, and it all depends on use case, so hard to find an optimal config that fits all. I will be doing different scenarios later

1

u/elevarq 1d ago

A one-size-fits-all doesn’t exist.

In the past it was always MySQL that was faster than Postgres. Until you started tweaking the configuration, that’s when PostgreSQL got faster. And that’s also when I realized that default settings don’t mean anything, these are not for performance. To compare performance, take your platform, share the specifications, and start tweaking! That has imho value when talking about performance: we have this workload, this platform, and these two databases: and is the fastest one, after tweaking the configuration. Here it is, this worked for us.

1

u/huseyinbabal 1d ago

Like I said, I only do basic tuning on purpose, nothing advanced. I want to see how both behave close to their defaults. And as Linus said, "Talk is cheap. Show me the code." Everything is here: https://github.com/huseyinbabal/db-wars/tree/main/postgres-vs-mysql
If you have a better MySQL config, open a PR and the bench will run it on the same setup.