DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Top 8 PostgreSQL GUI Software in 2021
  • 5 Key Postgres Advantages Over MySQL
  • PostgreSQL vs Oracle: When Higher Cost Means Better Performance
  • Database Bottlenecks Nobody Talks About: Optimizing SQL Queries Beyond Indexing

Trending

  • Multi-Agent Orchestration on AWS With AgentCore Runtime and A2A
  • OpenTelemetry's OpAMP Potential Far Beyond Supporting Collectors
  • Running TypeSafe AI's Jev Inside Neo4j for Confidence-Aware Sentiment Decisions
  • Kill the Worker, Keep the Research: Build a Recoverable LangGraph Agent on Temporal

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Data Engineering
  3. Databases
  4. PostgreSQL vs MySQL Performance

PostgreSQL vs MySQL Performance

Sometimes a highly scientific performance test doesn't speak well about the end result you might end up with. Using a "fully-fledged app" is therefore better.

By 
Thomas Hansen
DZone Core CORE ·
Dec. 14, 21 · Analysis
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
33.0K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

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 ... ;)

Database MySQL PostgreSQL

Opinions expressed by DZone contributors are their own.

Related

  • Top 8 PostgreSQL GUI Software in 2021
  • 5 Key Postgres Advantages Over MySQL
  • PostgreSQL vs Oracle: When Higher Cost Means Better Performance
  • Database Bottlenecks Nobody Talks About: Optimizing SQL Queries Beyond Indexing

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook