PostgreSQL vs MySQL Performance
When you need a database, you typically chose one according to its performance, and/or feature set. However, a "highly scientific performance test" might not speak much about your application's end resulting performance. Due to these reasons, I chose to create a "fully fledged app" using Magic and Hyperlambda, and I chose to create it twice. Once using Oracle's Sakila database and then once more using PostgreSQL's Pagila database.
The reasons why this is interesting, is because the Pagila database is more or less an exact "port" of the Sakila database, including each row in its tables. This allows us to measure the performance differences between these two different databases, and end up with a result resembling the performance difference we might expect in our application.
In the following video I am demonstrating the differences between my two different apps, and my "guesstimate" of the differences here is that MySQL is roughly 25% faster than PostgreSQL. Notice, none of my apps takes advantage of database specific features, such as full text search in PostgreSQL, etc - So depending upon your exact needs, obviously this would seriously change the conclusion. But these two apps basically does the exact same thing, and if you're building a standard CRUD app, the following performance differences between MySQL and PostgreSQL can be expected.
Both databases are installed with all default values, and no configuration changes have been applied after installation. Both databases runs on localhost, and according to the Pagila creator, the database is an "exact port" of the Sakila database. Hence, as an enterprise administration application software developer, the above is roughly what you could expect as of today using the latest version of PostgreSQL and MySQL (December 2021 is the date today). My test also doesn't measure throughput, concurrency, memory usage, etc, etc, etc - Only "raw performance" doing paging, and it does it through the exact same codebase, resulting in the exact same SQL, running towards the exact same database. Both tests are done on the same machine (MacBook Air 2021 version) with Intel chip. And both tests are done simultaneously, implying what software I am running, or other things my computer happens to be doing, should not play a significant role in any ways.
Notice - The first paging I am doing on the "Film_actor" table results in an SQL statement with two joins; One left join towards the "film" table and another towards the "actor" table. The second paging I am doing on the "Actor" table is a simple SQL select statement, without any joins.
Conclusion; MySQL is roughly 25% faster than PostgreSQL
And yes, I realise that a lot of people didn't want to hear the above, but feel free to reproduce my performance test as you see fit, and/or comment with whatever concerns you might have in regards to my test in the comment section of this article. If you want to reproduce my test, watch the video above, and then download everything required to reproduce my test below.
- Download Magic Cloud
Psst, if somebody wants "the honour" of porting the Sakila database to Microsoft's SQL Server, I would love to run my test again, adding SQL Server to the mix - However, I suspect we all know the answer to that question already ... ;)