TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why is MySQL more popular than PostgreSQL?

12 点作者 quoderat大约 16 年前

12 条评论

tezza大约 16 年前
<i>1.</i> .:: Memory at the right time ::.<p>When MySQL first started to take off (circa 1998) it had a lower memory requirement. So did PHP.<p>Memory was the most precious resource at that time, and so MySQL, PHP expanded rapidly.<p>They are both still going strong from that initial popularity spurt.<p>.<p><i>2.</i> .:: Novice coders do not think about DB corruption ::.<p>:: If you are new to coding, and have not been classically trained in a Computing Degree, it seems that people don't care for transactions or consistency.<p>MySQL was/is worse than Postgres on both these fronts, but the users do not care. At all. And if they do care, it may be because they heard that it was important, rather than actually feeling ill without transactions.<p>.<p>:: I value my users and would never want to inflict data loss on them if I could avoid it. I also know SQL well from my Computer Engineering degree and industry experience with Oracle / PSQL / DB2. So I use Postgres and have since 1996.<p>Most people using MySQL don't realize they could cause data loss to their customers. Even if they do, they may still use MySQL and work around failures by having adequate backup strategies that cover them even if MySQL failed at a bad point.
olefoo大约 16 年前
One factor has to be the fact that for a long time the only way to install Postgresql on windows was to build it within Cygwin. Whereas mysql could be run on win98 with a standard installer.
评论 #620054 未加载
adinobro大约 16 年前
I'll add my 2 cents :-)<p>A lot of it has to do with historical reasons which have reinforced themselves over time.<p>Here are some of the early differences:<p>* MySQL had an ungly way to allow users to only see their tables. While it wasn't great it was better than PostgreSQL which didn't really have a way to hide other databases.<p>* MySQL could create and destroy connections quickly. PostgreSQL made more robust connections but they took longer to setup.<p>* MySQL ran simple queryies much quicker under a light load.<p>* PostgreSQL database maintence tasks often required the database to be offline.<p>While these differences didn't make a big difference in a business environment PostgreSQL would have been a better option because:<p>* Use connections pools and not care about the connection setup time.<p>* Have a high load and care more about how the database ran under load.<p>* Have a trusted users and not care that they could see other databases.<p>* Have maintence periods.<p>That being said in the business world users used MS SQL or Oracle. Where MySQL took off was shared hosting which:<p>* Had light usage.<p>* Limited resources which meant that they often banned connection pooling.<p>* Had multiple untrusted users.<p>* Can handle a slowdown but not downtime.<p>In this situation MySQL was the better option.<p>This then caused a network effect where most software was written for MySQL so more companies offered it (remember at this time lots of companies only offer static hosting). Since most companies offered it more people wrote software that supported it.<p>Programs that support PostgreSQL often support MS SQL, MySQL and a number of databases BUT there are a number programs that only support MySQL. This means that if you want to run a number of programs it is easier to run MySQL rather than PostgreSQL since you'll have to run it anyway.<p>So while PostgreSQL has largely fixed the problems they had on shared hosting MySQL still has the market share.
oomkiller大约 16 年前
Based on my experience with other developers, they can't figure out how to login to the database and create users, databases, etc, initially, IMO mainly due to the default config doing ident only by default, and not allowing passwords to be used unless you setup pg_hba.conf first. I think that gets into sysadmin territory for the masses of developers, that just want to install, run a few commands, and go.
评论 #619988 未加载
patio11大约 16 年前
My Rails app runs on MySQL because my blog runs on MySQL and, since they're all black boxes for me anyhow, why bother installing another service.<p>At work, our Rails apps run on Postgres because our Big Freaking Consultingware runs on Postgres and, since they're all black boxes for me anyhow...<p>File that as instance #572 of the Power of Defaults. Now, go take a look at the popular OSS and commercial packages for deployment at web hosts, and you're going to see a preponderance of MySQL. (Wordpress, VBulletin, etc, etc.) That is a self-fulfilling prophecy.
gaius大约 16 年前
Well here's the thing: your typical web-oriented developer doesn't like SQL much. Probably because thinking in sets is very different from OO or whatever they're into. Most of them try to hide from it behind Rails/ActiveRecord or Hibernate or whatever. MySQL has a very basic, crude SQL and so doesn't intimidate them. Whereas to use PostgreSQL to its fullest requires really getting into set theory and relational thinking.<p>Plus if you look under the covers of MySQL each "table" is just a file on the disk. Unsophisticated database users feel comfortable with that too. "Sharding", another thing they like, is another attempt to evade using advanced features (not that partitioning is actually "advanced" these days, nor is a semi-decent query optimizer) that other databases take for granted.
评论 #620018 未加载
评论 #620027 未加载
rantfoil大约 16 年前
Surprised that nobody has mentioned replication. MySQL replication is a known quantity. PostgreSQL has it, but they're third party and less proven/battle-hardened.
评论 #620231 未加载
评论 #620225 未加载
abalashov大约 16 年前
I would say the bulk of it is ease of administration, and, as others have mentioned, the ability to get it up and going and use quickly and simply while having a relatively opaque understanding of how an RDBM works underneath.<p>The other major difference is that MySQL AB put a lot more effort into having an extremely concise, easily navigable and user-friendly online documentation repository and associated support community. Postgres has since made good strides in this area, but a lot of the documentation still reads like something intended for a fairly specialised audience that more or less knows what it wants; the ignoramus-friendly parts of MySQL's documentation are a lot friendlier.<p>For this and its administrative simplicity, it just got to be known as the quick and easy database, and Postgres as the rocket science database. (In reality, this is not true; only Oracle is the rocket science database. :-)<p>Also, MySQL was/is more appealing to corporate adopters since an Actual Company(TM) is Behind(R) the project. Postgres has a commercial footprint in the form of various third-party consultancies like CommandPrompt, but the core of the project is a Debian-like anarchic band of hackers. Nothing turns corporate America off more than a bunch of long-haired GNU hippies when it comes to big-ticket stuff, though they begrudgingly put up with it for Linux by now, Linux having become somewhat "legitimised" by the backing lent to it by IBM, the existence of Redhat, etc.
fauigerzigerk大约 16 年前
There are a few pain points with postgres that have been holding it back. Lacking Windows support has been mentioned (that's in the past now fortunately). Incredibly cumbersome (you could say broken) unicode support makes postgres difficult to use in not exclusively english speaking environments. And mysql is faster for simple things.<p>On the other hand postgres is way faster for complex queries and its support for SQL features is second to none.
评论 #620098 未加载
评论 #620070 未加载
sethg大约 16 年前
Shared-hosting providers generally offer MySQL as part of their low-end packages, but not PostgreSQL (I assume this is because MySQL is easier to administer in a shared environment). So if you want your web app to use PostgreSQL, you have to find a PostgreSQL-specific provider or take responsibility for administering your own box.
volida大约 16 年前
In the old days, it had a very good JDBC driver that later MySQL bought.
timcederman大约 16 年前
Inertia plays a part.