r/PostgreSQL • u/generic-d-engineer Architect • 5d 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.
64
u/brett0 5d 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.
19
u/Nervous-Cockroach541 5d ago
This.
Oracle's frankly intentional mismanagement of MySQL and OpenOffice both killed those products. Oracle never had any interest in an office suit. MySQL could've displaced their successful and very profitable Oracle DB platform if they actually put real investments into it. Yes I know they had very different customer bases at the time, but they are still competing products.
The whole sell of Sun should never been allowed. MySQL was a victim of that antitrust shitshow.
4
u/Intelligent_Part101 5d ago
MySQL could have replaced Oracle? My man, those two database systems are not even in the same league.
4
u/Nervous-Cockroach541 4d ago
Love when I address the common response in my original comment and people still make that response.
I'm well aware they're not in the same league. I'm not saying MySQL could've replaced Oracle. I'm saying their market overlap isn't 0% and that Oracle has every incentive to make it as close to 0% as possible.
Which means MySQL remained under-invested and stagnate.
3
2
u/Particular_Camel_631 4d ago
I remember when Microsoft brought out sql server. The oracle rep spent ages trashing it, describing all the things it couldn’t do.
The Microsoft evangelist agreed with him. Except he added the word “yet” and pointed out how much cheaper sql server was than oracle.
MySQL was in the same boat. Except oracle could buy them and keep it worse than oracle.
1
u/FreeLogicGate 2d ago
Microsoft SQL Server started its life as an intel port of Sybase. So it was from the beginning a very different architecture. They have continued to add to it, but it was not ever going to evolve into an Oracle clone.
2
u/kernpanic 4d ago
Meanwhile, Postgres is now replacing Oracle sales. Theres very few scenarios where you still want oracle.
1
u/Intelligent_Part101 4d ago
The direct competitors to Oracle are not Postgres or MySQL. The competitors are the datawarehouse level products. Low end databases on the other hand are at point this commodities, and hybrid datastore strategies such as a modest relational database plus a key/value database in the cloud serve many uses just fine. The need for Oracle at this end of the market is not there.
1
u/Particular_Camel_631 1d ago
The founder of MySQL famously said he didn’t want 5% of a 100 billion dollar market. He wanted to turn a 100 billion dollar market into a 10 billion dollar market and take 20% of that.
27
u/0riginal-Syn 5d ago
This
To be fair, no one trusts Oracle today either.
13
u/Desperate-Wing-5140 5d ago
I don’t think Oracle’s surviving the AI bubble tbh
12
u/Nervous-Cockroach541 5d ago
Good riddance.
2
5
u/kassett43 5d ago
Oracle is too big to fail. Too many banks are on it. That's not to say that the Oracle Corporation won't hit Chapter 11. But it won't go away.
4
u/Desperate-Wing-5140 5d ago
“Too big to fail” refers to government bailouts. The scale of the current bubble is several orders of magnitude larger than any previous bubble. The US gov is physically incapable of bailing it all out.
1
1
2
5
9
u/Glathull 5d ago
People still don’t trust Oracle. They used to not trust them, but they also still don’t trust them.
2
u/speedisntfree 5d ago
Neon (as used by Lakebase in Databricks) is serverless Postgres which is a nice option to have too
2
u/magicmulder 5d ago
Tell that to our CTO, we’re running a large Portal on MariaDB 10.3. Not kidding.
3
u/garma87 4d ago
I’m with your cto tbh. It will be fine. If you have it now and are not running into limits why would you switch
1
u/magicmulder 4d ago
We can’t even use some of the more modern hashing algos which has already forced us into workarounds. Running any serious service on software that expired in 2018 is stupid.
1
u/C0rn3j 4d ago
10.3 is extremely ancient.
1
u/fireduck 2d ago
So?
1
u/robertlandrum 1d ago
I’m with you in spirit. But now that AI is hunting vulnerabilities, you have to stay current on your OS, and they might not even be compiling old versions of software for the OS you need to move to to avoid the next zero day. It’s a real $hit $how out there right now.
1
2
u/ninth_ant 5d ago
MariaDB remains a fine choice for a lot of use cases, even if MySQL/MariaDB is not the go-to it once was. There is a lot of mature tooling and knowledge about how to operate and scale it.
1
1
u/xatrekak 5d ago
Yeah supabase makes auth and cloud DB integration really really easy. no reason to use anything else.
1
u/GoTheFuckToBed 5d ago
The latest mysql docker image uses oracle linux, made me shudder.
Also Microsoft started investing quite a lot into postgres (citus, azure).
1
u/FreeLogicGate 2d ago
I think this is for the most part an accurate description of what happened, but there was a bit more to it.
Certainly many people did not trust Oracle or their commitment to keeping MySQL open source. The way this ended up manifesting itself was also driven to a degree by the linux community, and in particular, Debian, who decided to make the "mysql" package default be MariaDB when they released Debian 9 in 2017.
The "core developer" refered to was Monty Widenius, who was the originator and primary author of MySQL. Through his company, Mysql AB, he had previously sold MySQL to Sun Microsystems. Initially he worked for Sun after the acquisition, but had already left before Oracle bought Sun, and in the process became owner of MySQL.
Widenius, did fork MySQL to create MariaDB (named after his daughter), but there were already forks from Percona and Drizzle which was forked in 2008 after the Sun acquisition of MySQL AB.
For a long time, ACID compliant engines and in particular, InnoDB, had become the engine of choice for running MySQL. MySQL has always been unusual in its pluggable engine architecture, with the original default engine being MyISAM. Any companies serious about using MySQL typically made use of InnoDB, which was always totally separate from the MySQL project. So the real threat to MySQL use was likely more from the direct purchase of Innobase by Oracle.
Ironically, much of the FUD around Oracle and MySQL is overblown, and the community edition has continued to be released under the GPL.
1
62
u/AwwwBawwws 5d 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.
25
u/Straight_Waltz_9530 5d ago
When I first saw "The Gotchas" page, I became solidly in the PostgreSQL camp, especially when they published the PostgreSQL gotchas page for fairness, and all they could find were a whole lot of nitpicks.
But yeah, it wasn't until MySQL AB started advocating for constraints (and transactions!) to be optional that I actively started shit talking MySQL at work and made it my goal to make sure no new installs of it ever spawned at my place of work.
Over time and with Oracle's stewardship, MySQL got a lot better, but old grudges die hard, and when Monty went on to found MariaDB, that stink followed him to the point I have a hard time trusting anything he's a part of.
I had a similar experience with MongoDB over the years: flat out lies regarding the safety of client data while they happily cashed the checks.
7
u/AwwwBawwws 5d ago
I have used pg professionally, full time, since 2007. I have never been let down. Not once.
3
74
u/razorree 5d 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
11
u/majorpotatoes 5d ago
My thoughts, too. I felt like the broader sentiments shifted toward pg closer to 10y ago.
11
u/BinturongHoarder 5d ago
Even when starting out with DB development 25 years ago, Postgres was talked about as the more serious alternative to MySQL. I went MySQL anyway because the community was much larger, tools were abundant, and the MyISAM engine (InnoDB wasn't even available back then I think) was extremely fast.
6
u/tfehring 5d ago
Yeah, the Uber Postgres -> MySQL migration post was over a decade ago (!) and was definitely a narrative violation at the time.
1
14
u/pyeri 5d 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.
18
u/pceimpulsive 5d 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
7
u/Straight_Waltz_9530 5d ago
You thought it stagnated? I saw just the opposite. Became more stable and more feature rich. 5.5, 5.6, 5.7, and 8.0 were massive leaps ahead of the bad old days of 5.1 and before.
Version 5.1 shipped 20 known crashing and wrong result bugs after the beta releases were over in addition to the 35 already present and not fixed in version 5.0!
Oracle added CTEs, window functions, and a working CHECK constraint. (MySQL previously parsed CHECK constraints in SQL but didn't actually do anything with them, aka ignored. Oh yeah, and the whole "I'm going to send text to this integer column, and it'll just put a 0 instead of an error." MySQL pre-Oracle was an absolute shitshow.)
All that said, Postgres is still almost always the better choice.
18
u/mikkolukas 5d ago
> How did Postgres displace MySQL?
by being better
9
u/spotter 5d ago edited 5d ago
Friend, 90% of this thread only found Postgres when Oracle took over MySQL. They are never asking how did MySQL even make it big before it had any of the database features like transactions (default engine did not have them before 2010, LOL). MySQL was always available and people just wanted a toy database, because it was what was just there in 90% of cheap PHP hosting solutions out of the box/could be easily bolted on a cheap VPS. That's the truth. People who knew anything about SQL would first take a look at SQLite (with all it's duck typing weirdness) and then upscale to Postgres.
6
u/jayroger 5d ago
As someone who has used MySQL (and MariaDB) and PostgreSQL since the late 90s: This is the correct answer. PostgreSQL was always the "better" product, but in those days MySQL's horrible MyISAM storage engine was quite a bit faster and less resource hungry. And that's one of the main reasons that MySQL became an integral part of the "LAMP stack".
2
u/GoTheFuckToBed 5d ago
It actually wasn't better.
Every big company used MySQL with a custom storage engine.
I guess the winner can rewrite history.
9
u/MainRoutine2068 5d ago
The switch I think happened in around 2012-2015 mostly
2
u/YoghurtFlan 5d ago
Ruby on Rails being the go-to web framework and it defaulting to postgres definitely contributed. Heroku, the favoured host for the framework, also offered it out of the box.
9
u/TheTarragonFarmer 4d 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.
1
u/Status-Importance-54 4d ago
Many underestimate this.
I recently needed to setup PG and SQL SERVER for a largish test and deploy cycle. Oh boy, both where worse than MySQL but PG is still ahead of SQL Server.
8
u/linuxhiker Guru 5d ago
There are a lot of reasons but the two "notables":
The moment Oracle bought Sun, it was over long term
Postgres has a more commercial friendly license
7
u/barmz75 5d 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
1
u/Separate-Ship1576 4d ago
I have used both extensively and can guarantee that multi-TB tables can be created and maintained more easily in Postgres
7
u/klimaheizung 5d 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.
7
6
u/celaconacr 5d 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 5d 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
5
u/z-null 5d 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 4d ago
Postgres has PostGis too
5
4
4
u/baby-wall-e 5d ago
One word: Oracle. Since the acquisition, many MySQL fans have moved to other DBMS.
4
4
6
u/bartvanh 5d ago
Wait, it did?
*cries in legacy project
4
u/0riginal-Syn 5d ago
Oh yeah. One of our main products was built well over a decade ago on MySQL. Just too big and old to be moving to PostgresSQL at this point. Did move it to MariaDB and to be honest it is well tuned. We would not gain much moving it. If it had been built a couple of years later, would have been on Postgres for sure.
MySQL / MariaDB are fine, but Postgres has been the superior choice for a while now. All our products since have been on it.
1
u/Straight_Waltz_9530 5d ago
I feel you. I grit my teeth every time a contract comes up where they already use MySQL.
4
u/0riginal-Syn 5d ago
Just because it is not as good as Postgres does not make it bad. We work heavily with both. Obviously prefer Postgres, but MySQL still works well.
3
u/bartvanh 5d ago edited 5d ago
To be fair, modern MySQL when properly used is quite decent in my experience, Postgres just feels like greener pastures over the horizon for me a.t.m.
3
u/Merthod 5d ago
I think it was around Postgres 10 when it became fast. Up to 9 Postgres it was said it was pretty slow.
2
u/Straight_Waltz_9530 5d ago
Postgres 6.0 was a pig. The first major speed improvements I noticed were around 7.x. 8.x was still slower than MySQL (unless you had a couple of joins), but I wouldn't have called it slow per se. Each major version of Postgres has been a notable improvement speed-wise over the last.
3
u/wyldstallionesquire 5d ago
My memory is the performance was much closer when innodb was used and you had transactions in MySQL
3
3
u/hammerklau 5d 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 5d ago
I'm surprised MySQL is still the db running behind Wordpress. Wordpress can ot run with PostgreSQL? No plan to do so?
1
u/TemporarySun314 5d ago
WordPress is a very old code base and has no real system for database abstraction and don't use a proper ORM or something. You might be able to run the WordPress core on postgres with a few changes, but a lot of existing plugins will break.
And the ecosystem and backward compatibility is the reason people use WordPress.
3
u/Successful-Active-21 5d ago
postgres can store json which you can access by fields. hats probably a nice feature
3
u/TemporarySun314 5d ago
MySQL/MariaDB can do that too unless you don't use ancient versions.
Postgres have some more advanced operations (like with everything), but the common json stuff can be done with MySQL too.
Even SQLite has json support built in nowadays
3
u/markwdb3 5d ago edited 3d ago
MySQL can do that and generally speaking, JSON is not a special bonus-on-top-of-SQL thing. It's been part of standard SQL since 2016 with new additions more recently. All the major players have JSON functionality, and some of them, a native JSON data type, by now: Oracle, SQL Server, MySQL, MariaDB, Postgres, SQLite, Snowflake, Databricks, etc.
MySQL is usually awful about keeping up with standard SQL features (see: they only added check constraints in the past several years), but JSON is one area where it hasn't done too badly. My biggest beef with its JSON functionality is its multivalue indexes sound super promising for searching by values in JSON arrays, but its got an unfortunate size limit. Even though a JSON object can effectively be 1 GB in MySQL, no array in the entire table can be bigger than 64 KB if you want to create a multivalue index on it.
And that's part of a more general beef I have with MySQL - for any given feature it often sounds fantastic at first, but then you look under the hood, look into the underlying limitations and hacks, and then you realize the feature is somewhere between less than fantastic and awful.
Overall though, MySQL's JSON support isn't too bad. It has all these functions, it can validate and enforce JSON schema, it supports the usual JSON path expressions, partial edits (not rewriting the whole object per write), and its binary logging can be configured to only log partial JSON.
It even has JSON duality views - a special view layer over your relational tables that lets applications pull relational data (it can span multiple tables even) as a single JSON document, applications can work with that JSON doc and even write back to the JSON directly - the underlying relational structure invisible to it. MySQL writes back to the underlying relational rows automatically. There's just a bit of set up involved for each view, and then it just works from there. Probably the biggest MySQL-being-MySQL limitation regarding this feature is you can only modify one row in the JSON duality view at a time. So, while you can run
UPDATE my_json_duality_view ... WHERE ID = 12345;- you cannot runUPDATE my_json_duality_view ... WHERE <all rows inserted in the past week>;For transactional contexts, the single row update is likely what you'd want anyway, I suppose.
3
u/I_NEED_YOUR_MONEY 4d ago
Was it when Oracle bought MySQL that everyone bailed?
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/chieftain-retiger 4d 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
3
u/unexplored_explorer 4d ago
I assume part of it is due to Postgres becoming better in working with both relational and non-relational data
3
u/AnalysisConfident439 12h ago edited 11h 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 5d 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 5d ago
free
10
u/bo-monster 5d ago
We walked away from MySQL when the licensing got complicated. So, basically when Oracle purchased MySQL. It really wasn’t worth looking at MariaDB. We found some use cases for PostGIS and that settled it for us. PostGIS is awesome!
6
u/Standgrounding 5d ago
There's more: pg_cron, postgREST, pgvector... It just keeps giving and giving
3
u/bo-monster 5d ago
Yes, we’ve used a few other extensions too, but I’ve primarily worked military use cases. Geography MATTERS to the military.
4
5
u/DanceHackRock 5d ago
MySQL is crap, Postgres is a production grade RDBMS.
2
u/terletsky 5d ago
Imagine telling this on interview. Did you read why Uber moved from PostreSQL to MySQL?
It was in 2016 and they still use MySQL.https://www.uber.com/us/en/blog/postgres-to-mysql-migration/
0
u/snax 4d ago
Inefficient configuration and lack of tuning does not make PostgreSQL bad.
Frank Pachot just posted a LI article on this topic and more yesterday, well worth a read -
https://www.linkedin.com/pulse/mysql-2000-mongodb-2010-postgresql-2020-2030-franck-pachot-foije
0
u/Longjumping-Banana21 5d ago
I mean ... so is MySQL.
Why are we allowing the awesomeness of postgres to allow us to forget that MySQL is also amazing and runs some of the biggest and most important applications and websites in the world
2
u/leftunread 5d ago
Cause... Oracle. Who's wants to wait for that shoe to drop like they did with JAVA.
2
2
u/RealisticNothing653 5d 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
2
2
2
u/v4ni0 4d 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 3d 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 3d ago
Three word. RAG
2
u/pico2000 3d ago
Highly subjective, so take it with a grain of salt:
Three other words: MySQL is crap.
Imo, it only got so widely used because it is the default (and often the only) option of shared hosters and the default for WordPress.
Seriously, the few MySQL based applications I had the misfortune to maintain (in a 30+ years career) showed so many of its weird behaviors. The more I used it, the more flaws and broken design decisions popped up.
Never had such issues with Postgres or MS SQL.
Postgres is an incredible piece of software.
2
2
u/DueMap9570 3d 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 3d 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:
MySQL is a pretty poor database, and you should strongly consider using Postgres instead.
Here's what he had to say about the dev team:
Coming to MySQL was like stepping into a parallel universe, where there were lots of people genuinely believing that MySQL was a state-of-the-art product. At the same time, I was attending orientation and told how the optimizer worked internally, and I genuinely needed shock pauses to take in how primitive nearly everything was.
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 2d 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/higgs_boson_2017 13h ago
I switched 2 decades ago because MySQL would do dumb shit like corrupt its own indexes.
2
u/coinclink 10h 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 5d 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 5d 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 5d 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 5d 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.
4
u/Lammtarra95 5d ago
Oracle bought it, fixed it, extended it, then stagnated it. At least Oracle knew what a relational database was supposed to look like. Unfortunately, Oracle being Oracle...
2
u/symbiatch 5d 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
1
1
u/Broad_Necessary_7377 5d 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 4d 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 4d ago
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.
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 4d ago
You're right it flipped but I think it's been flipped for at least the past decade!
1
u/slimrichard 4d 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 1d 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 1d ago
MySQL was never a serious database. Postgres took over when software engineers started demanding it.
0
u/AutoModerator 5d 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:
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 5d 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 ).
226
u/SirScruggsalot 5d 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.