适用于Web应用程序的MySQL与PostgreSQL [英] MySQL vs PostgreSQL for Web Applications

查看:109
本文介绍了适用于Web应用程序的MySQL与PostgreSQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Python(Django)开发Web应用程序,并且想知道在进行生产部署时,MySQL还是PostgreSQL更合适.

在一个播客中,乔尔说他在使用MySQL时遇到了一些问题,但数据不是持续的.

我想知道某人是否有任何此类问题.另外,在性能方面,可以轻松调整吗?

解决方案

给以后的读者的注意事项:以下文本的最后编辑时间为2008年8月.距本次编辑大约11年前.软件的版本可能会迅速变化,因此,在根据以下建议选择DBMS之前,请进行一些研究以查看其是否仍然正确. 在下面检查新的答案.


更好?

MySQL通常是由网络主机提供的.

PostgreSQL是更成熟的产品.

此讨论解决了您的更好"问题

显然,根据此网页,MySQL速度很快当并发访问级别较低时,并且读取次数多于写入次数.另一方面,随着负载和写入/读取比的增加,它的可伸缩性较低. PostgreSQL在低并发级别时相对较慢,但是在增加负载级别时可以很好地扩展,同时在并发访问之间提供足够的隔离度,以避免在高写入/读取比率下的速度降低.它继续链接到许多性能比较,因为这些因素对条件非常敏感.

因此,如果您的决定因素是"哪个更快?",那么答案是这取决于.如果这确实很重要,请针对两者对您的应用程序进行测试."而且,如果您真的很在意,您会得到两个DBA(一个专门研究每个数据库),并让他们从数据库中调出废话,然后选择.令人惊讶的是,好的 DBA多么昂贵;和他们每一分钱都值得.

重要时刻.

可能不知道,所以只要选择您喜欢的声音的数据库并进行选择即可;可以使用更多的RAM和CPU,更合适的数据库设计以及巧妙的存储过程技巧等来获得更好的性能-对于所有随机网站X而言,与烦恼MySQL或PostgreSQL相比,所有这些都更便宜,更容易,并通过昂贵的DBA进行专业调优.


乔尔还在那个播客中说,评论会再次引起他的注意,因为人们会说MySQL只是一堆废话-乔尔无法获得count行.轶事的复数形式不是数据. 他说:

MySQL是我职业生涯中唯一针对数据完整性问题进行编程的数据库,您在数据库中进行查询并得到无用的答案,那是不正确的.

他还说:

这只是个轶事.实际上,这是令我沮丧的一件事,有关博客或整个Internet. [...]有一种将轶事变成事实的怪异趋势,而实际上,作为一个博客作者,我对此感到有点内

I am working on a web application using Python (Django) and would like to know whether MySQL or PostgreSQL would be more suitable when deploying for production.

In one podcast Joel said that he had some problems with MySQL and the data wasn't consistent.

I would like to know whether someone had any such problems. Also when it comes to performance which can be easily tweaked?

解决方案

A note to future readers: The text below was last edited in August 2008. That's nearly 11 years ago as of this edit. Software can change rapidly from version to version, so before you go choosing a DBMS based on the advice below, do some research to see if it's still accurate. Check for newer answers below.


Better?

MySQL is much more commonly provided by web hosts.

PostgreSQL is a much more mature product.

There's this discussion addressing your "better" question

Apparently, according to this web page, MySQL is fast when concurrent access levels are low, and when there are many more reads than writes. On the other hand, it exhibits low scalability with increasing loads and write/read ratios. PostgreSQL is relatively slow at low concurrency levels, but scales well with increasing load levels, while providing enough isolation between concurrent accesses to avoid slowdowns at high write/read ratios. It goes on to link to a number of performance comparisons, because these things are very... sensitive to conditions.

So if your decision factor is, "which is faster?" Then the answer is "it depends. If it really matters, test your application against both." And if you really, really care, you get in two DBAs (one who specializes in each database) and get them to tune the crap out of the databases, and then choose. It's astonishing how expensive good DBAs are; and they are worth every cent.

When it matters.

Which it probably doesn't, so just pick whichever database you like the sound of and go with it; better performance can be bought with more RAM and CPU, and more appropriate database design, and clever stored procedure tricks and so on - and all of that is cheaper and easier for random-website-X than agonizing over which to pick, MySQL or PostgreSQL, and specialist tuning from expensive DBAs.


Joel also said in that podcast that comment would come back to bite him because people would be saying that MySQL was a piece of crap - Joel couldn't get a count of rows back. The plural of anecdote is not data. He said:

MySQL is the only database I've ever programmed against in my career that has had data integrity problems, where you do queries and you get nonsense answers back, that are incorrect.

and he also said:

It's just an anecdote. And that's one of the things that frustrates me, actually, about blogging or just the Internet in general. [...] There's just a weird tendency to make anecdotes into truths and I actually as a blogger I'm starting to feel a little bit guilty about this

这篇关于适用于Web应用程序的MySQL与PostgreSQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆