r/PostgreSQL • u/generic-d-engineer Architect • 13d ago
Community How did Postgres displace MySQL?
For many years MySQL was the default go to open source database, and Postgres was always the “other one,” but at some point in the past 3 years, it flipped.
Now Postgres is considered the default go to for pretty much everything.
Was it when Oracle bought MySQL that everyone bailed?
Always been a huge fan of BSD and Postgres, the engineering on both has always been just really really well done.
436
Upvotes
231
u/SirScruggsalot 13d ago
I'd argue that it has been longer than 3 years, but ... Postgres started as being the rigorous choice, it focused on fundamentals, but wasn't performant. MySQL was fast(er) and was the wordpress default. Those two things caused it to proliferate. It had warts though (silently truncated text, etc ).
Overtime, Postgres got faster and those solid fundamentals allowed for a more feature rich ecosystem to be built around it.
65
u/brett0 13d ago
It was about 10 years ago. Oracle bought Mysql and a core developer forked the project, because at the time, he and many others didn’t trust Oracle. He started MariaDB. This created a divide in the community. Postgres introduced JSONB proper indexing support, in defence against CouchDB and MongoDB, which won the developer community over. This is around the time they introduced sharding/clustering, which made them a complete solution.
More recently, Supabase has made it easy for onboarding and helped with growth.
64
u/AwwwBawwws 13d ago
Lol
When Monty said, "foreign keys? You can do that in code."
It was then I knew. Mysql was a toy. Sometime around 2003-4.
75
u/razorree 13d ago
i think it flipped more than 10y ago, i guess you missed it.
mysql never offered proper transation isolation etc. and maybe 20-30y ago a lot of web "developers" didn't think about it too much
14
u/pyeri 13d ago
Oracle coming after Monty Widenius was the biggest reason, most open source enthusiasts don't trust that company after what they did to Sun Microsystems. While MariaDB did appear as a robust community fork, postgresql felt like the path of least resistance for many devs.
PostgreSQL is governed by the PostgreSQL Global Development Group, backed by a coalition of companies rather than a single corporate entity. This independence gives both enterprises and developers some peace of mind. PostgreSQL also uses a BSD style permissive license allowing maximum freedom for modification, embedding, and commercial distribution.
12
u/davidw 13d ago
I have been using Postgres since 1997 quite happily and every time I looked at Mysql it was always like... wait.... it doesn't do that?!
18
u/pceimpulsive 13d ago
Yes oracle buying it and stagnating it really made people.reconsoder it's use.
Also around the same time Postgres was really just better across the board anyway
18
u/mikkolukas 13d ago
> How did Postgres displace MySQL?
by being better
9
u/MainRoutine2068 13d ago
The switch I think happened in around 2012-2015 mostly
9
u/TheTarragonFarmer 12d ago
Postgres was always the better database, but harder to set up and tune.
MySql (MariaDb) cut corners left and right to simplify deployment and speed up simple operations that were typical in web applications. It became the "standard" in the LAMP stack: Linux, Apache, MySql, Php. It was all you needed if you were a php developer, and there used to be a LOT of php developers.
Over time, Postgres became simpler to deploy, and real database features and ACID guarantees became more important. On the bottom end, noSQL key-value stores ate into MariaDB's market share.
I don't think the Oracle fiasco made much of a difference, it was just a rename for most people. MariaDB was at first fully compatible with pre-Oracle MySql.
8
u/linuxhiker Guru 13d ago
There are a lot of reasons but the two "notables":
7
u/barmz75 13d ago
I still use MariaDB for everything, I’m used to fine tuning it to billions of rows and multi TB tables which I’m not confident at all doing with postgres
7
u/klimaheizung 13d ago
Not in the past years.
Thing is, good developers always knew that postgres was generally MUCH better. mysql was always pretty shitty and only had very few performance advantages (due it's simpler and shittier design).
I always knew that postgres would "win". It won maybe 10 years ago btw.
6
u/celaconacr 13d ago
I agree with what most people have said regarding MySQL. I think the other thing that's happened is developers moving from MS SQL Server adding to its popularity.
SQL Server was at one point a good stable choice and relatively cheap or even free. It has got much more expensive over time and Microsoft is focused on getting people to the cloud which often isn't in the interests of the projects using it. Postgres is relatively easy to switch to especially if you are using Entity Framework Core.
6
u/shayhtfc 13d ago
For some reason I've always had it in my head that MySql was used by hobby developers and people just wanting a simple to set up database, whereas Oracle/Postgres were for the big boys
6
u/merlinm 12d ago
Mysql positioned as an application managed data store. Postgres positioned as an enterprise backend with rich server functionality.
Also the oracle acquisition hurt.
5
u/z-null 13d ago
As much as people always liked postgresql more, mysql had a couple of advantages that postgres fixed very late in its existence. One of the big ones was high availability. Some 15 years ago if you wanted to have a highly available system that can upgrade with zero downtime or run some weird queries, mysql was the only real way to go. Unfortunately, for a the longest time there simply was no robust way to setup a HA system on postgresql. Sometimes when I tell this to people they go with "oh, but who cares for 15-30 minute downtime for my code deply/db upgrade in the middle of the night". A lot of people do for various reasons. Even now postgresql has some design limitations that make it harder to use in the cloud than mysql (in some scenarios which may or may not affect you).
5
u/GregBreak 12d ago
Postgres has PostGis too
4
u/Rain-And-Coffee 13d ago
This one was asking the same question and had a decent article
https://www.reddit.com/r/PostgreSQL/s/kyUF5UFRgk
4
u/baby-wall-e 13d ago
One word: Oracle. Since the acquisition, many MySQL fans have moved to other DBMS.
4
u/shilltom 13d ago
Postgres has schemas.
4
u/hornetmadness79 13d ago
Postgres is cheaper than MySql in RDS.
6
u/bartvanh 13d ago
Wait, it did?
*cries in legacy project
3
u/Merthod 13d ago
I think it was around Postgres 10 when it became fast. Up to 9 Postgres it was said it was pretty slow.
3
u/max_wen 13d ago
It was definitely when Oracle bought it that everyone abandoned it.
3
u/Molasses_Major 13d ago
PostGIS
3
u/hammerklau 13d ago
PostGres is a powerhouse. MySQL has been the lightweight easier to use but less complicated but with how good Postgres is in speed now and functions now. and with oracle buying out MySQL and local things just using SQLite or libSQL, MySQL doesn’t really fill a niche other than things like planet scale. Either you need the power and you go Postgres, or it’s local severless with sqlLite. Postgres can even do json doc style storage now as a binary to allow schema less things similar to mongo now even.
3
u/StandardIntern4169 13d ago
I'm surprised MySQL is still the db running behind Wordpress. Wordpress can ot run with PostgreSQL? No plan to do so?
3
u/griso84 13d ago
One word: Oracle
3
u/Successful-Active-21 13d ago
postgres can store json which you can access by fields. hats probably a nice feature
3
u/I_NEED_YOUR_MONEY 13d ago
yes. even then, postgres was a better DB but mysql was the default for no other reason than it was what everybody used, and if you were starting a project and didn't want to spend time choosing a db engine, you chose mysql. oracle buying it made people question using it, which was all it took to realize there was very little reason to use it over postgres.
3
u/mpanase 13d ago
oracle being stupid
postgres people being a cult (and actually good at what they do)
3
u/chieftain-retiger 12d ago
it all started the day mysql was (had to) fork. Downhill from there.
As of 2027, postgres is the logical choice, supported almost everywhere as first class citizens
3
u/metaphorm 12d ago
postgres is both technically superior and better governed
3
u/unexplored_explorer 12d ago
I assume part of it is due to Postgres becoming better in working with both relational and non-relational data
3
u/AnalysisConfident439 8d ago edited 8d ago
MySQL was like a pain in the ass
In 2 words: query cache
Postgres IS much more stable and resource savvy
5
u/rando1-6180 13d ago
PostgreSQL had some lofty goals. It have developed of the years based on that. I remember reading that it was intended to be an enterprise database. The target was Oracle and there was a project to port Oracle code to work on PostgreSQL. It is has a developer friendly community. I've listened to hours of talks by brilliant people. There are wickedly smart people thinking about PostgreSQL. The thought and work put in shows in what you can do with it. I made my own aggregate function. It was fun and productive. There is so much you can do with it. These differences are very likely due to the leadership of the project. MySQL has a corporate leadership.
I remember MySQL being used for lots of db back web apps that were ready heavy and it didn't have ACID compliance. It was known for being fast and this is a great fit for websites back then.
I only recently started using MySQL because of work. The drop off in developer experience is pretty big. There is some weird crap with DELIMITER ;; because some legacy tooling needed it. It one example of low developer experience. Anyway, I remember Oracle bought them and Maria db spawned. Oracle wouldn't want any cannibalization. Before that, I believe they were also company owned. Someone else here will know better, but I don't think MySQL gets new features very quickly.
I believe more and more developers and admin see PostgreSQL as unencumbered and capable of doing much more.
6
u/camel_case_enjoyer 13d ago
free
4
u/Junior-Tourist3480 13d ago
It didnt
5
u/DanceHackRock 13d ago
MySQL is crap, Postgres is a production grade RDBMS.
2
u/leftunread 13d ago
Cause... Oracle. Who's wants to wait for that shoe to drop like they did with JAVA.
2
u/sackfullofhammers 13d ago
3 years? This has been an ongoing process over the last decade or so.
2
u/RealisticNothing653 13d ago
I realized postgresql was superior in 2012, but at that time, I was already late to the party. I've never looked back
2
u/totally-jag 13d ago
My organization moved away from MySQL when Oracle got involved.
2
u/olzk 13d ago
Oracle contributed a ton after buying Sun. the rest is simply consequential
2
u/revilo-1988 13d ago
MySQL ging an Oracle .
2
u/empire299 12d ago
Oracle.
2
u/v4ni0 12d ago
I remember reading the source code and testing both MySQL and PostgreSQL in the late 90s when I worked at a company that was transitioning to using more open source technologies. Back then MySQL only had MyISAM as a storage backend and lacked a lot of functionality - most importantly transactions. It was faster but the lack of ACID support was a huge deal breaker for us and we ruled it out within a day. Things got a little better when they introduced InnoDB but then the performance dropped significantly. Years later I had to do work for customers who were using MySQL and it was always a pain for large complex systems. I would never recommend it over PostgreSQL for a project that is starting from scratch. I don't think Oracle did much harm because it was quickly forked and MariaDB became the first option for MySQL users. And no, the users didn't bail. There are still a lot of open source projects that support only MySQL. In fact most PHP developers who build simple websites prefer it.
2
u/JeffSelf 12d ago
I knew PostgreSQL was a far superior database as far back as 2000. I went to work for a company that provided support for PostgreSQL in 2001. Company was a startup, but didn't feel like. We had more VPs than employees. Not really, but it felt like it. They made some wrong decisions early on, like only wanting to support our boxed version of PostgreSQL, even though it was the same product. They didn't change that policy until it was too late.
But I got to meet several of the top PostgreSQL developers while I worked there. We actually shut the company down on Friday, September 7, 2001. Four days before 9/11.
2
u/Training-Pay-8964 12d ago
Three word. RAG
2
u/Dense_Age_1795 12d ago
Oracle bought it and the people fleed to Postgres
2
u/DueMap9570 11d ago
I tend to build basic CRUD applications with PHP + MySQL. It has been great for the past 15 years of my career. It performs as well as anything else.
2
u/itgforlife 11d ago
In addition to what everyone else has said, a former dev on the MySQL team published an article called Leaving MySQL.
Here's what he had to say about the database:
Here's what he had to say about the dev team:
It also had a poor reputation among developers who were familiar with databases. Oracle gaining ownership of it was just the final nail in the coffin.
2
u/dani_estuary 11d ago
Oracle's acquisition of MySQL might have been a reason for concern, but I think it was a gradual shift rather than a sudden shift. PostgreSQL's strong SQL compliance and support for JSON made it popular amongst developers. I believe the rise of modern web apps and tools like Supabase also helped popularize it.
2
u/navicat-gu 10d ago
I don't think there was one moment. It was a slow build of several things, with the Oracle acquisition as the starting gun rather than the cause:
MySQL is still massive in installed base (WordPress/PHP-land, plenty of big web companies), it's just not the default answer for new projects anymore.
Disclosure: I'm RC, Director of Digital Strategy @ Navicat, so we see both sides daily since a lot of our users run both. Navicat 18 handles Postgres and MySQL/MariaDB in one app, and Navicat Premium Lite is free to try. Cross-database data transfer and sync are paid features.
2
u/higgs_boson_2017 8d ago
I switched 2 decades ago because MySQL would do dumb shit like corrupt its own indexes.
2
u/coinclink 8d ago
In addition to what others have said, which I agree with: In my experience, postgres has a lot more useful extensions. You can do crazy things in there, PostGIS is a big one for geospatial work I've worked on, for example. but there are dozens of well supported extensions for niche industries that just make standardizing on postgres a great idea for use-case future-proofing.
Also, I just find that it generally works a lot smoother during major version upgrades and scalability too. Tbh, I feel like MySQL sticks around just because so many projects have used it in the past when it was the easiest thing to set up. Nowadays, I would never choose MySQL to start a new project, but it's totally fine if that's what an app is already built on.
3
u/Responsible-Offer724 13d ago
3 years? Anyone who wasn’t locked in already and actually evaluated the options has been using Postgres for over a decade.
3
u/CautiousUse8597 13d ago
Oracle buying MySQL pushed some people away, but I think the bigger reason is the license and how extensible Postgres is. It has a permissive BSD-style license and was designed to be extended, so anyone can fork it, swap out the storage layer, or build a whole new product on top of it without asking permission. That's why so many newer databases are Postgres underneath: Aurora PostgreSQL, Google AlloyDB, Supabase, Neon, Timescale, Citus and YugabyteDB's query layer. Redshift also started out as a Postgres fork.
Databricks Lakebase is a recent example. It's built on Neon's tech, so storage and compute are separate. That gives you autoscaling and scale to zero. You can also make instant copy-on-write branches of a database, like git branches for your data, which is handy for testing or giving an agent its own sandbox. And you get instant point in time restore. On top of that it syncs with lakehouse tables, so apps can serve analytics data with low latency without you building a separate ETL pipeline. Your app still just sees regular Postgres.
Once an ecosystem gets that big it snowballs. Every new tool supports Postgres first, so it ends up as the default.
2
u/Aggressive_Ad_5454 13d ago
First of all, it’s mostly MariaDb that’s available at no extra charge on budget hosting these days, not MySql. (Many Linux distros switched over a few years back.) So the proper comparison for market share is PostgreSQL vs ( MySQL + MariaDb)
PostgreSQL supports more SQL standard features. It has a more elaborate and performant suite of indexing tech. It’s got, well, Michael Stonebraker’s work in it.
Monty Widenius’s work (MySQL and MariaDb) has superior Unicode collation handling, which is good. But it has prefix indexes, which suuuuuuuck.
2
u/tcloetingh 13d ago
Oracle bought it, stagnated it, and tied its reputation to it. Postgres continued to develop, remained open, and became a formidable adversary to Oracle.
2
u/stump82 13d ago
I would say about 8 years ago when postgis filled the need for geospatial data during the saas peak. That opened everyone's eyes to the power of extensions and now postgres can adapt to whatever the current trend may be. Currently pgvector and whatever is next
2
u/symbiatch 13d ago
It’s a combination of things.
Monty got greedy and whiny. People started realizing MySQL really has a lot of issues and complications. PostgreSQL got even more great features and continued to be developed in a rational “when it’s ready” way. And so on.
I’m glad it happened. Even though MySQL/MariaDB had evolved quite a bit it still carries the old history. Being a wrapper around other people’s engines, having different rules for different engine, silently ignoring constraints, developers saying it’s not the database’s job to ensure integrity, allowing dates like February 30th, I could go on…
At one point people just cared about speed and things were smaller. Then they realized there’s much need for reliability also. Things changed.
1
u/dektol 13d ago
3 years aye? I don't suppose you code in PHP too? 🤔
1
u/RedditNotFreeSpeech 13d ago
It's been like 20 years. Postgres was open and performant.
1
u/jhwheuer 13d ago
Worth a watch https://youtu.be/wtC3Ie3UDpw?is=nVELoMOL6uZhUSs4
1
u/Broad_Necessary_7377 13d ago
Postgresql para mí siempre a sido mejor, pero era lento bajo alta demanda, eso y que la licencia de postgresql es más favorable para el entorno comercial, hoy en día postgresql ya no es tan lento como antes ( desde mi perspectiva diría que tiene funciones mejores, pero siendo honestos lo diría desde mi sesgo porque tengo años que no uso MySQL/maríadb como se debe por tanto y a este punto se volvió una preferencia personal )
1
u/Ok_Outlandishness906 12d ago
the change of Mysql licenses and the fact that now mysql communities and mysql enterprise supports different type of data (some new feature are only in enterprise ) , in my opinion are being a great nogo for mysql with the end of the compatibility with Mariadb . People is afraid of oracle in term of licensing. Think about what happened to java licensing .... among versio 8 and 17 ... and after ...
1
u/Adorable-Strangerx 12d ago
Huh, for me PostgreSQL is default database roughly since 2012. The reason is simple: it just works. MySQL is okayish but the config was more challenging and annoying.
1
u/lots_of_puppies 12d ago
You're right it flipped but I think it's been flipped for at least the past decade!
1
u/slimrichard 12d ago
I remember seeing how it would handle transaction roll-backs where there were different table engines that didn't always support transactions. It would roll-back the data in tables that supported transactions but not the others. Then just go along like nothing happened. RIP
1
u/ognev-dev 10d ago
you must be lost in time. I was an avid MySQL user back then, and that was about 10 years ago. I remember it was sold twice, which didn’t feel reliable, and the only mature alternative was Pg. There was community hype that MySQL was now proprietary and Pg was open and community-driven, and since then Pg has remained true to that, while providing everything we need from an RDBMS.
1
u/al_earner 9d ago
MySQL was never a serious database. Postgres took over when software engineers started demanding it.
0
u/AutoModerator 13d ago
AI Policy:
Linux is not one of those anti-AI projects, and if somebody has issues with that, they can do the open-source thing and fork it. Or just walk away., Linus Torvalds.
Mod decisions will be based on the quality of the content, not who or what generated it.
Sub Resources:
Youtube Channel
Free Postgres Webinars and Workshops
Discord: People, Postgres, Data
Join us, we have cookies and nice people.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
0
u/PaulPhxAz 13d ago
What I don't like about postgres ( or didn't a few years ago ) was the trendy culture around it. Poor sproc support ( and it has its places ). Active-Active-Actice replication topology is harder to setup.
But yeah, mysql does a bunch of goofy stuff too, I just learned to live with it. CTEs being missing is minor, window functions -- that's much worse.
Setting large searchable case-insensitive columns in both has its problems ( contains anywhere not just start or end searching ).
I prefer binlog replication for multi-datacenter ( multi-provider ).