为什么 Heroku 使用 Postgresql?

发布于 2024-10-06 22:09:24 字数 337 浏览 3 评论 0原文

我正忙于将一些 MySQL 特定代码移植到 Postgresql,以便将其与 Heroku 一起使用。只是想知道 Heroku 选择 Postgresql 而不是 MySQL 是否有任何具体原因?性能、架构等?

更新:来自heroku 博客文章

在 Heroku,我们相信 PostgreSQL 提供了最佳组合 强大的功能、数据完整性、速度、标准合规性以及 全球任何 SQL 数据库的开源代码。

I'm busy porting some MySQL specific code to Postgresql in order to use it with Heroku. Just wondering if there is any specific reason why Heroku went with Postgresql over MySQL? Performance, architecture, etc?

UPDATE: From a heroku blog post:

At Heroku, we believe PostgreSQL offers the best mix of
powerful features, data integrity, speed, standards compliance, and
open-source code of any SQL database on the planet.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

夕嗳→ 2024-10-13 22:09:24

Postgres 在很多方面都优于 mysql。您可以阅读这些关于将 Rails 应用程序从 mysql 迁移到 postgres 的文章。虽然 mysql 是 比 postgres 更流行,但是 instagram 使用 postgres 可能是由于这些原因。我觉得postgres比mysql更成熟、更健壮。而mysql更容易使用。

在 Rails 中将 MySQL 迁移到 PostgreSQL « Mindle v

转换 Rails应用程序数据从 MySQL 到 PostgreSQL

对于数据迁移,一个方便的小脚本:Rake 任务传输 Rails 数据库,例如从 MySQL 到 Postgres 并再次返回

Postgres is better than mysql in many ways. You can read these posts about migration rails app from mysql to postgres. Though mysql is more popular than postgres, but instagram is using postgres maybe due to these reasons. I feel postgres is much more mature and robust than mysql. Whereas mysql is more easy and simple to use.

Migrating MySQL to PostgreSQL in Rails « m i n d l e v

Converting Rails application data from MySQL to PostgreSQL

For data migration, a handy little script: Rake task to transfer a Rails database, say from MySQL to Postgres and back again

神爱温柔 2024-10-13 22:09:24

MySQL 陷阱 列表的长度与 postgresql 陷阱。 MySQL 更有可能让你陷入困境。

Compare the length of this list of MySQL gotchas to this list of postgresql gotchas. MySQL is much more likely to mess you up.

不必了 2024-10-13 22:09:24

一般来说,我发现 pgsql 比 mysql 更适合 24/7 操作。此外,它内置的枪似乎也更少。我认为如果您对其中之一更熟悉,那么这比其他任何事情都更有可能影响您的决定。

Generally speaking I find pgsql lends itself to 24/7 operations better than mysql. Also, it seems to have fewer footguns build into it. I think if you're more familiar with one or the other, that's more likely to influence your decision than anything else.

喵星人汪星人 2024-10-13 22:09:24

嗯,Postgres 上的性能通常对于复杂查询更好,比如 ORM 生成的查询。而且,Postgres 往往更加“可靠”。这是先例,但我管理的 postgres 服务器总是比 mysql 麻烦得多,mysql 喜欢偶尔随机崩溃,偶尔会在崩溃时损坏表。

Well, performance on Postgres is generally better for complex querys, like the kind generated by ORMs. Also, postgres just tends to be more "solid". This is ancedotal but the postgres servers I've managed have always been much less troublesome than mysql, which likes to randomly crash once in a while, occasionally corrupting a table on the way down.

季末如歌 2024-10-13 22:09:24

我目前正在将客户的一个 Rails 应用程序从 Heroku Postgresql 迁移到 Mysql(ClearDB 插件)。 PostgreSQL 在很多方面都是一个更严格、更“正确”的数据库服务,这似乎就是 Heroku 认可它的原因。然而,我发现 Rails 框架或多或少地消除了差异,并且大多数 Rails 应用程序不会发展到足以让 Mysql 的性能问题成为问题的原因。

另一方面,PostgreSQL(特别是 Heroku 的产品)对于启动应用程序来说有几个明显的缺点:

  • 价格。为了防止在使用 Heroku Postgres 时每周出现“数据库连接丢失”错误,您必须每月支付$200。在 ClearDB 上,每月 10 美元的计划承诺提供 100% 的正常运行时间(我们还没有机会评估这一说法),该计划还提供 1 GB 的空间——比我们提供的空间还要多永远需要。
  • 列排序。在进行 Rails 开发时,我每 5 分钟引用一次 schema.rb 数据库模式文件,为了保持该文件整洁和可读,我发现至关重要能够指定列的添加顺序。MySQL支持指定列的顺序; PostgreSQL 没有。在许多情况下,此功能并不重要,但由于 Rails / ActiveRecord 的工作方式,当我无法对列进行重新排序时,我的生活变得更加困难。

I'm moving one of my client's Rails apps from Heroku Postgresql to Mysql (the ClearDB addon) at the moment. PostgreSQL is a stricter and more "correct" database service in many ways, which appears to be why Heroku endorses it. However, I find that the Rails framework more or less smoothes over the differences, and the majority of Rails apps won't grow big enough for Mysql's performance issues to become a dealbreaker.

On the other hand, PostgreSQL (in particular Heroku's offering) has a couple sharp disadvantages for a startup app:

  • The price. To prevent weekly "Database connection lost" errors when working with Heroku Postgres, you have to shell out $200 / month. On ClearDB, you get a promise of 100% uptime (we haven't had chance to evaluate this claim yet) for the $10 / month plan, which also offers 1 GB of space -- more than we'll ever need.
  • Column ordering. When doing Rails development, I refer to the schema.rb database schema file every 5 minutes, and to keep this file tidy and readable I find it crucial to be able to specify what order columns should be added in. MySQL supports specifying the order of columns; PostgreSQL doesn't. In many cases, this feature is unimportant, but because of how Rails / ActiveRecord works, my life becomes much harder when I can't reorder columns.
々眼睛长脚气 2024-10-13 22:09:24

与上述任何建议并不矛盾,但如果出于某种原因您确实想要或需要坚持使用 MySQL,我最近注意到 Heroku 现在提供一个免费的 MySQL 附加组件,称为 ClearDB:

https://addons.heroku.com/cleardb

没有使用过它,所以我不能保证它。 Heroku 声称免费版本的正常运行时间为 99.95%(相对于任何付费版本声称的正常运行时间为 100%),并且他们否认免费版本已“生产就绪”。他们声称 ClearDB 是“原生的、未经修改的 MySQL”。

Not contradicting any of the above advice, but if for some reason you really want or need to stick with MySQL, I recently noticed that Heroku is now offering a free MySQL add-on, called ClearDB:

https://addons.heroku.com/cleardb

Haven't used it, so I can't vouch for it. Heroku claims 99.95% uptime for the free version (versus 100% uptime claimed for any of the paid versions,) and they disclaim the free version as being "Production Ready." They claim ClearDB is "native, unmodified MySQL."

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文