7 ms·
100% naive question: why is mysql and their similars so popular then? Spanner and AWS Aurora base off of more mysql than postregsql from what I can tell. Why?
by mrep 8y ago
100% naive question: why is mysql and their similars so popular then?
Spanner and AWS Aurora base off of more mysql than postregsql from what I can tell. Why?
- johncolanduoni 8y agoProbably because compatability with MySQL is more valuable than comparability with Postgres from a product perspective.
- tejtm 8y agoWill make an attempt to answer, hopefully without starting anything. Mysql aimed for lowering bar for non-dba-app-developers. Postgres did not. In some cases it matters, in many it does not, especially if you have the dba skills on hand to mind the gaps.
- ma2rten 8y agoMySQL used to be more popular. It was the M in the LAMP stack, which virtually everyone used to use. It also used to be more scalable, because PG's replication story used to be poor. This is why Google and (I assume) Amazon used MySQL internally. This is all a long time ago, but I suspect this is the reason more people are familiar with MySQL than Postgres at these companies. Keep in mind that Spanner was developed and used internally at Google long before it was publicly announced.
- mrep 8y ago> This is why Google and (I assume) Amazon used MySQL internally. Amazon actually uses a lot of Oracle with some scattering of MySQL.
- reitanqild 8y agoThat's weird. But maybe at their scale even Oracle can be made tolerable. That, and they have some serious leverage in negotiations. (I used to deal with Oracle DBs a lot a few years ago but thankfully not anymore.)
- tfehring 8y agoIt looks like Amazon's migrating away from Oracle pretty aggressively, however. https://www.cnbc.com/2018/08/01/amazon-plans-to-move-off-oracle-software-by-early-2020.html https://www.cnbc.com/2018/08/01/amazon-plans-to-move-off-ora...
- manigandham 8y agoMySQL was easier to run. Both for beginners where it was packaged with PHP and available with basically every webhost, and for advanced users that took advantage of the simple and reliable replication. There were a lot of problems with it, but the novice users didnt run into them and the advanced users knew how to deal with it. These decades of mainstream use carry a lot of momentum and many large companies continue to use it because they've always used it (like Youtube for example). PostgreSQL only recently became much more usable after v9.5 and is now being recognized and growing in popularity.
- philliphaydon 8y agoPostgreSQL has been useable Long before 9.x, however I think features of 9.x have made it much more popular as of late. I think I first started using it at v6 or 7. I liked it could I could run it from a .bat file and spin it up for tests without installing it.
- spion 8y agoReplication is still a pain.
- scurvy 8y agoIndeed. MySQL replication topologies with GTID are super easy to maintain and run. Does Postgres still require "extra" tools like pg_rewind to do a simple operation like turning a former primary server into a new replica? Some of the MySQL backup/restore stuff is a lot more straightforward (innobackup vs WAL shipping).
- cookiecaper 8y agoGTIDs are relatively new and require some porting work to implement on pre-existing databases. MySQL replication is a massive disaster without them. Like most things in PostgreSQL, there is a bit of extra legwork to get things set up right up front, but when they work, they work. MySQL replication with binlog_pos was a total crapshoot. The reason innobackupex exists (and anything from Percona, to be honest) is because MySQL's default options were so unworkable. The Postgres equivalent is probably something like barman.
- rgbrenner 8y agoHistory. A long time ago, in the early 90s, there was a database called msql. It was a little DB that used SQL and ran well on low end systems. It was also free. In fact, it was the ONLY free SQL database out at the time -- that's why it was written. Because of those two advantages (that really only lasted a couple of years), a small ecosystem developed around it. This was the database you used to develop interactive websites in the early/mid-90s. Then MySQL came. MySQL extended mSQL, and kept compatibility with it's ecosystem... and people switched from mSQL to MySQL. Postgres also existed in the 80s and 90s, but it used POSTQUEL, was harder to setup, and had higher system requirements. Not a lot, but enough to discourage use on low end computers. (Remember, Postgres at the time was being developed on university servers, where they had plenty of system resources.) They did address these points in postgre95 (in fact, Postgres adopted SQL as a response to mSQL popularity), but by then it was too late. mSQL and MySQL already had an ecosystem.. and in that brief moment, they lost the race. The idea that it was slower stuck around for many years, even after the improvements in computers, and (less so) optimizations in Postgres made it no longer true. Postgres didn't start being considered again until Go, RoR, et al started to become popular.. displacing the PHP ecosystem. And the biggest reason you see MySQL around so much today is that there's about 25 years of legacy code built around it. Edit: If you're curious what POSTQUEL was like: https://en.wikipedia.org/wiki/QUEL_query_languages https://en.wikipedia.org/wiki/QUEL_query_languages
- apapli 8y agoI’m no expert on this topic and have used both PG and MySQL. My preference is MySQL purely because the syntax is easier, or at least consistent with what I learned at uni in the late ‘90s. I also like MySQL workbench, although I’m sure there is an equivalent for PG I haven’t needed to look for one in recent years. If PG allowed me to use the same syntax as MySQL I’d probably switch, purely because experts and those with more experience than I generally prefer PG for a whole lot of reasons. EDIT: I should have googled first before replying. Looks like the syntax is near enough to identical for my simple needs and pgadmin will do what I need. I’m not sure why I had to learn some other weird syntax in 2012 for postgres, perhaps it was just shortcuts. Either way I’m going to seriously consider migrating now. :)
- akavel 8y agoWhat syntax do you have in mind? Can you give sone example of what you see as easier in MySQL than Postgres? Genuinely curious, I don't have money in that game
- apapli 8y agoI recall having to type /d from the command prompt to show databases (or something like that). I prefer “show databases”.
- mrep 8y agoHaha, same. When I first used a postgres database, I got super annoyed trying to figure out how to simply show the databases and tables as I kept trying to use show and describe.
- petepete 8y agoThe standard way to do this would be to query `information_schema. tables`. PostgreSQL's approach isn't the most intuitive but it's well documented and very powerful. A few aliases could probably help, it's good they've added `quit`/,`exit` this time around.
- mgkimsal 8y ago
- dotancohen 8y ago> Why? Notice that parallel to MySQL's rise a particular loosely-typed, never-except, often-wrong programming language also became popular. To this day I feed my family with that language. The typical coder (not that I do not say "developer") who codes in PHP does not care about correctness. He does not understand why monetary values cannot be stored in floats, he does not know what bitwise manipulation is, he does not know the difference between character encodings. What does he care what MySQL does, he knows that he can put strings in if he calls them VARCHAR, and he can pull the right one out with a WHERE. He cares not enough to check that user bios fit in his VARCHAR, and when he learns to JOIN he does not understand which constraints to put in the ON clause. I do have nicer words for the L and A in the stack.
- rgbrenner 8y agoIn fairness, some of this is historical baggage that MySQL got stuck with from it's early popularity. mSQL was a free/low cost SQL database in the early 90s. Originally it was an SQL translator built on top of Postgres (that used POSTQUEL). That was too slow (because Postgres had higher system requirements), so a new lightweight engine was developed for it.. and that's what later became MySQL. The point was a lightweight SQL database that ran well on cheap early-90s computers. The compromises to make mSQL fast were inherited by MySQL, and they can't be easily changed without breaking the ecosystem that was developed around mSQL/MySQL. Postgres on the other hand, was a university project in the 80s and 90s being developed on mainframes. It was always a slow moving, cautious project. Yes, it didn't make the compromises mSQL made, because it didn't have to. It used more memory, more CPU, but was more correct/safe than MySQL. That was the same reason it lost in the 90s. mSQL was out being used by websites and other projects on cheap computers. Postgres was mostly waiting for computer tech to get fast enough so they wouldn't need to compromise their code too much to take it off the mainframe an on to cheaper computers. Postgres only adopted SQL in response to mSQL's popularity. Early Postgres was also harder to setup, another point that wasn't addressed until after mSQL took off. MySQL was popular because of the compromises they made. If mSQL just kept Postgres as the engine, MySQL never would have existed. And if they instead waited (even a couple of years), and did things correctly, they wouldn't have beat Postgres -- which had a decade lead in development and was more advanced than mSQL/MySQL.
- samcheng 8y agoI used both of them, but migrated to Postgres permanently a decade ago. Early on in my career, the biggest selling point for Mysql was the excellent web admin tool "phpMyAdmin" - it really helped get applications off the ground, since the core of most modern systems is the data model. Users could modify data, without your needing to create a UI for that use case. It conveniently used the same stack as the rest of the software, but I remember spinning up a phpMyAdmin instance even after moving away from PHP as an application language. Postgres still doesn't really have anything like that! The closest that comes to mind is Django's Admin tool.
- rgbrenner 8y agophpPgAdmin, started ~2002: http://phppgadmin.sourceforge.net/doku.php http://phppgadmin.sourceforge.net/doku.php Basically a port of phpMyAdmin to postgres. I used it for several years around ~2003-5.. it's nearly identical.
- luhn 8y agoI’m a regular Postgres user and fan, but cut my teeth on LAMP. I can’t speak to the current state of the projects, but phpMyAdmin was vastly superior to phpPgAdmin in the 2000s. phpMyAdmin remains the best DB GUI I’ve ever used. (Although I haven’t used any GUI in quite a few years.)
- deleted 8y ago[deleted]
- gbuk2013 8y agoIt was the same for me - back when I first learned SQL I really tried to use Postgres but phpMyAdmin was so much better than pgMyAdmin that I gave up. A lesson in the importance of user-friendly UIs. Perhaps some developers can really nail a schema on first go, but for me it usually takes a lot of tweaking before I can really understand what I want and the CLI is not the best place for that, especially if my mind is deep in the code I am trying to write.
- 8y ago
- twunde 8y agoHistorically postgres was slower than MySQL, harder to manage than MySQL, wasn't available on shared hosting and generally speaking wasn't beginner friendly. Because of this a generation of programmers learned MySQL, especially as everything PHP used MySQL. As such the install base for MySQL, was quite large so there were more potential customers for MySQL projects (WordPress, drupal and Joomla all run on mysql, so we're talking about 50% of websites before talking about custom applications)
- jpalomaki 8y agoFor the Spanner and Aurora: MySQL has a lot less features. For example on the query side it has been really limited compared to Postgres. Maybe this was a plus in this case. Less features make it essier to optimize.
- gwn7 8y agoProbably accessibility. Because MySQL for some reasons is more accessible[1] to beginners, juniors, average developers, and other people who may prefer a lower barrier of entry over correctness/safety (e.g. full-stack devs, managers, people who don't have much time); who form the bulk of the community combined. It's the same for languages, frameworks, and other tech; as several people noted already. [1] Or maybe "was"; in which case the answer becomes "historical superior accessibility".
- Keyframe 8y agoMyISAM made it popular back then, and the rest of it is inertia.
- mistrial9 8y agofrom second-source information: in the late 90s, just about every database product in the world, from tiny to massive, was tested as a backend to various web sites. Scaling was still being invented. MySQL was simply the fastest (only by microseconds) to return a set of strings to a php page, and php was a fast development environment. Neither php nor MySQL had the rigor that many in the database world demanded, and that was ok. In fact that helped to make the MySQL/php combination fast. Once the herds picked MySQL (and php) the economies of scale started, and advantages grew. Meanwhile, the proper and safe competitors were generally disgusted (drama word but not entirely an exaggeration) but who cares about them, maybe even a weird positive to the new breed of web devs who were inventing the future.
- evanelias 8y agoThe question of MySQL's popularity comes up often in HN Postgres threads. The answers naturally skew towards being a bit one-sided, as most people clicking on a Postgres article tend to be Postgres users currently (and sometimes former MySQL users in years past). This can result in comparisons of modern-day Postgres to 5+ year old versions of MySQL. That said, and with a disclaimer that my own bias leans the other way (as I have a lot more MySQL experience than Postgres experience) although I try to be impartial about these things: * Spanner: I've heard this second-hand and might be incorrect, but as I understand it, Google's original internal MySQL team was shuttered in ~2009 and some of those folks may have transferred over to the Spanner team. I wouldn't say that Spanner is particularly based off of MySQL anyway though, but I don't have enough familiarity to say that conclusively. * Aurora: AWS now offers a Postgres-based Aurora as well. As for why the built the MySQL one first, I'd assume that was likely a business decision based on mysql-vs-postgres RDS usage at the time. * Those two aside, there are definitely major products based around Postgres. AWS Redshift is one example. Or look at CockroachDB, which chose wire-protocol compatibility with Postgres. (There are some examples the other way too; e.g. TiDB, which chose wire-protocol compatibility with MySQL). * Regarding why MySQL has historically been popular, there are a lot of factors. I'd say the biggest one for large users has been replication; some of my older HN comments delve into that more, https://news.ycombinator.com/item?id=16880663 https://news.ycombinator.com/item?id=16880663 for one example. For smaller users, ease-of-use has been important. The other discussions in this thread hint at this, especially around silly simple things like the "exit" command.
- jitans 8y agoThere is who cares about his data and who uses MySQL