MySQL vs PostgreSQL -- Choose the Right Database for Your Project

MySQL vs PostgreSQL – Choose the Right Database for Your Project

Which is better? MySQL or Postgres? In this post we’ll compare the strengths and weaknesses of each.

Nurio Fernández

Thank you for writing this article! It’s a good article but maybe can be better if you include some statistics comparing MySQL and PostgreSQL performance.

Uzma Jafar

Hello there, I want to develop a website similar to or where you can imagine hundreds of thousands concurrent users will read and write scripts/coding on real time editor, what database should I use for such type of projects?

Okta Developers

This is a tough question to answer and it’s likely many people have different opinions. My opinion is to use PostgeSQL. If you experience performance issues, try a different option.
The hard part won’t be scaling your application. The hard part will be getting thousands of concurrent users to use your service. :slight_smile:

Moayad Abu Jaber

There is alot of contradict in this article!!! even though I found it very informative

MySQL it support the GIS same as Postgres which make the above statement about the supported data type invalid

you mentioned alot of concurrency features in postgres which definitely makes big difference over MySQL in performance if it configured in the right way

Pablo Cabrera

Interesting article, thanks.

I’m doing extensive research and I came across this article:….
I wanted to ask if you don’t mind, if your statements about concurrency control advantages are based on real experience with large workloads or based on theory and documentation/articles online?
I’m honestly looking for a non-biased comparison, and it seems most articles online are just people swearing by their favorite DB or people doing benchmarks with vast experience with one DB and little to none experience in the opposite (in many cases using defaults which you pointed out is of different quality for both) which leads to unfair benchmark results.

Thanks in advance

Krasimir Hristozov

MySQL only added geographical data support to its spatial indexes in version 8.0 which is relatively new and I don’t have a lot of experience with it. So I can agree with your statement although I don’t know how well it handles such data. However, MySQL definitely does not support custom data types on the level of PostgreSQL.

Are there any other contradictions you’ve noticed?

Krasimir Hristozov

I can easily do that but performance benchmarks are highly specific to the application so it won’t be beneficial. As I wrote in the article, for most common use cases either database would do sufficiently well.

Krasimir Hristozov

I have rich experience with both systems at relatively large workloads but certainly not on the level/scale of Uber. Also, it’s important to note that both systems are constantly improved and, as I wrote in the article, for most common use cases the differences in the latest versions of PostgreSQL and MySQL will be largely unnoticeable.

MVCC without read locks definitely offers advantages to write-heavy workloads, which can be easily measured with synthetic or real-world tests. I can see how long-running transactions can turn into a problem (per the Uber article), but this is really an application design error and it’s common sense that transactions should be short and should not wrap synchronous operations that can cause a delay.

Pablo Cabrera

Thank you very much for your response! I will share your article with my team

Moayad Abu Jaber

just to correct this, GIS support added in MySQL 5.7 :slight_smile:

personally I don’t have experience in Postgres Concurrency indexes but I’m sure this will give a big advantage over MySQL in term of performance

Muhammad waqas

Thank you for sharing such an informative article,
Buddy i just wanted to know is postgre recommended if i have to update,insert 1000 of record / sec. currently i am on mysql,
mysql queued running process and after some more load queued process are stucked and due to this latency increases.basically i am working on logging queries for my API.

Krasimir Hristozov


Depending on the hardware you have, inserting 1000 records/second should be quite achievable in both MySQL and PostgreSQL. However, logging queries for your API is probably not the best use case for a relational database - you should consider carefully what kind of information you’re logging and how you’ll search/retrieve that data, do you need to prepare aggregate reports on it or not, etc. You’d usually be better off using a specialized tool like the ELK stack (Elasticsearch, Logstash, and Kibana).


So there isn’t a “lot of contradict”? You backed off that pretty quick.

Moayad Abu Jaber

I failed in description, I should say couple of contradicts :slight_smile:


Thanks for the article. It helped me understand Postgres from a point of view I was already familiar with (MySQL).

Top Rock Photography

Great article. I almost did not read it through, because of an early error, making me consider the source. Glad I read it. Thank you.

Per that error; Postgres and PostgreSQL are two different things, one of which is mostly dead. Postgres was acquired by IBM, developed for awhile, then abandoned, as features were added to DB/2. (The IBM cloud now offers both DB/2 and PostgreSQL as options). Berkley had sold Postgres to IBM in 1994 when they moved on to Postgre95. Then they moved on to PostgreSQL.

Yes, many people do say, Postgres, (and PostgreSQL has finally recognised this, [July 2018], apparently abandoning their past stance of insisting that it only be called, “Postgre-Es-Queue-El”), but it does not make it any more right than people (like me), who say, “Sequel,” and not, “Es-queue-el.” (Sequel was again, indeed, a totally different product, doing something quite similar).

For the most part, though, I generally only hear the term “Postgres,” when used along with the term, “NoSQL,” (as in, “Postgres NoSQL,” something else which does not really exists), to refer to the JSONB, and other non-ANSI-SQL compliant datatypes and functions of today’s PostgreSQL.

Nevertheless, in an education setting, the correct terminology ought to be used.

Krasimir Hristozov

Thank you for this. I’ve heard the terms used interchangeably for years, and, according to the PostgreSQL wiki:
"Postgres is an accepted nickname for the project"…

However, the historical note is correct and I agree that it’s important to use correct terminology.

Kevin Tesar

Good information. Thank you. Was hoping for more about security though.

André Luís

Great article! Thanks!