Why is MySQL more popular than PostgreSQL? The fact that it is more popular is indisputable — take a look at MySQL’s market share page. My experience with PostgreSQL is very limited and my strongest impression was that the command line client has a weird interface, beyond that, I know little. PostgreSQL advocates are pretty convinced of its superiority over MySQL on every level.
PostgreSQL was released in its current form in January 1997. MySQL was initially released in May 1995, but the first version that saw really wide adoption — version 3.23 — came out in January 2001. I’ve always used MySQL but I never made an affirmative decision to choose it over PostgreSQL. Is there a reason why MySQL is more popular other than the power law reasons? What gave it the initial edge in adoption?
Update (5/21): This post is also being discussed at Hacker News. Check out the discussion there as well.
May 20, 2009 at 11:15 am
I’ve often pondered this same question and I think it’s largely due to MySQL having a lower barrier to entry, especially early on in its life cycle. A few years back it was very clear how to do things because, well, you didn’t have a whole lot of options. No need to worry about optimizing your sub-queries — you don’t have any! Until the last couple versions, MySQL was a pretty cut and dried tool which is probably why it turned into the defacto DB for many LAMP-style efforts.
By comparison, PG has always had a bit more heft and could be construed as confusing. It’s just enough of a departure from the other RDBMS’s to feel strange. I don’t know if that’s still true as it’s been a few years since I used PG, but I do remember my time with it fondly once I’d gotten used to it. As well, back then it definitely had the edge feature-wise, but I’m sure that gap has narrowed in the intervening 5-8 years.
May 20, 2009 at 11:18 am
I don’t know if it’s a factor or not, but for a long time MySQL was a lot easier to get running on Windows than PostgreSQL was.
May 20, 2009 at 11:38 am
I’ll second the “lower barrier to entry” theory. My remembrance is that not only was the PGSQL command set more baroque and confusing (from a db admin perspective, that is), but that the documentation for MYSQL was more readily available. This was a disadvantage for PGSQL and an advantage for MYSQL.
The computer nerds would wax about the relative performance gain by using PGSQL, but if you can’t administrate a database effectively, that means more or less nothing.
May 20, 2009 at 11:44 am
Caveat: This is fully anecdotal, not data.
One of the things I really remember about getting into database development was that if you cared about read performance, you went MySQL. If you cared about other things, PostgreSQL. Further, if you wanted an easy database that was somewhat error tolerant and fast (as long as you used ISAM) and didn’t care about transactions, stored procedures, etc, it was MySQL. ACID-compliance, stored procedures/triggers and the like, were PostgreSQL’s realm.
I remember from a LinuxConf circa 2000 where representatives of both engines were on the floor and the general impression from the Postgres-semi-commercial vendor was that MySQL was for n00bs who didn’t know any better.
I’ve used both, though it’s been years since I’ve used Postgres, and I know I’ve had my frustrations with MySQL’s stock options. But, my read on it now is, MySQL is (or was when it really mattered) beginner-friendlier, akin to using Perl w/o strict or warnings to learn programming vs. diving into Java.
May 20, 2009 at 12:40 pm
Like Nathan, my memory of the early years was that PostgreSQL has always been a full-on relational database first, speed somewhere way down the list, whereas MySQL in its early years didn’t have joins or multi-table selects, certainly didn’t enforce referential integrity or any of that stuff, and didn’t have transactions at all, but was a blazingly fast mostly SQL interface to records with keys.
I think when I wrote the early versions of the Flutterby CMS I actually avoided joins and multi-table selects so that I could port between them, although now the code base is pretty PostgreSQL centric.
The lesson for adoption here is “ship early, make it fast, worry about making it right later.”
May 20, 2009 at 1:00 pm
Echoing the ‘low barrier to entry’ theme: IIRC MySQL had a Win32 version very early in its life; Postgres has only had a stable one for the last couple of years. This allowed people to play around on their laptops.
I also suspect that PHP’s earlier (and existing?) DB-specific interface functions had something to do with it, since they locked people into a particular DB. Once you’ve gone through the trouble of installing the DB and compiling the client libraries into PHP, you might as well keep using it.
May 20, 2009 at 1:09 pm
I think the PHP theory is my favorite. Because of PHP’s deficiency (separate functions for every database type), the switching costs from one database to another were high. So people tried MySQL (easy to install and worked on Windows) and then thanks to PHP, they were essentially locked in. If PHP had something like DBI (for Perl) or JDBC (for Java), maybe it all would have gone differently.
May 20, 2009 at 5:27 pm
i think that it has a lot to do with why php took off as it did — mysql worked quite well in shared-hosting environments. user management was straight-forward, users could be relatively isolated into their own databases, and if a single table blew up, the damage was generally limited to that table. and upgrading the server didn’t require a dump/reload of all of the data.
May 20, 2009 at 5:37 pm
You’re right — one file per table is a huge advantage for shared hosting. Easy to move users from one server to another, no interdependencies between databases, etc etc.
May 20, 2009 at 5:59 pm
The last time I had a peek, lack of out of the box replication was a pretty major strike against PostgreSQL. I recall there was some kind of third party replication that you could bolt on. Didn’t give me a warm fuzzy feeling. Granted it’s been a couple of years so maybe native PostgreSQL replication is much improved now.
May 21, 2009 at 3:14 am
http://www.xaprb.com/blog/2008/05/18/why-is-mysql-more-popular-than-postgresql/ start by reading this on the same topic.
May 21, 2009 at 3:22 am
When i started using PHP, all the tutorials were based on MySQL and this alone introduced me to MySQL. Later all i needed in a database was provided by mySQL so i never really wanted to test anything new. Even now i have not used PostgreSQL and i am still comfortable with MySQL.
May 21, 2009 at 3:35 am
… because MySQL has a catchier name !
I don’t even know how to say ‘Postgres’, maybe it’s Spanish and rhymes with ‘-grays’, maybe it’s French and has a silent ‘s’ at the end, maybe it sounds like ‘-gress’ but has an ‘s’ missing, because the people who invented it didn’t know how to spell, (never a good recommendation for any product), maybe it rhymes with ‘ogres’ ?
If you have a product with a name that people are embarrassed to even say in a meeting for fear of looknig stupid, it’ll never take the world by storm.
May 21, 2009 at 3:39 am
My honest opinion: MySQL has a better and friendlier admin UI. I think most people underestimate how important this factor is for someone who has no experience with either DB, and has to try them out and choose.
May 21, 2009 at 8:29 am
I have used Oracle, Sybase, Ingres and SQL Server. Given the choice I would use Postgresql every time. It is very robust, has a terrific object oriented features and supports multiple languages for stored procedures.
MySQL has been in catch-up mode to Postgres out of the starting gate. It has got greater market share because it is easier to setup and use when your needs are simple. But for larger scale and/or complex projects I believe Postgres will not let you down. Having said that, I do believe that recent versions of MySQL are greatly improved, but with Oracle having acquired it, I would not stake any long term project on it.
July 7, 2009 at 5:28 am
Coming from a relational database theory background and working with Oracle, Postgresql was always the stand-out winner in the Open Source space – ACID conformance, OO features, performance on the kind of complex queries I was used to doing. I never really understood MySQL’s popularity, but now I guess I see that it was being measured by different criteria, as Dan pointed out “ship early, make it fast, worry about making it right later.”
Add to that the lock-in of certain API´s, and some OS projects which are tied to it, and MySQL’s popularity is clear. I’ve tempered my earlier distaste for MySQL’s many failures and lack of conformance which they’ve definitely improved on over time, but PostgreSQL still bests it in so many ways, and remains the only serious open source contender to Oracle in my view.
Does popularity really matter? I mean, Fords are much more common than Aston Martins, and probably easier for the casual driver to manage, but if you’re a drivers’ driver, which would you rather have?
July 20, 2009 at 2:05 pm
In the past, I’ve been trying to figure which database between the two is better for my applications. However, I have just recently found a database that is just perfect for my projects. I’m currently using RDM Server, an embedded database from Birdstep, mainly because of performance and quality of database. Other issues with reliability also forced me to consider the Raima database.