简体   繁体   English

为什么 Heroku 使用 Postgresql?

[英]Why does Heroku use Postgresql?

I'm busy porting some MySQL specific code to Postgresql in order to use it with Heroku.我正忙着将一些 MySQL 特定代码移植到 Postgresql,以便将它与 Heroku 一起使用。 Just wondering if there is any specific reason why Heroku went with Postgresql over MySQL?只是想知道 Heroku 使用 Postgresql 而不是 MySQL 是否有任何具体原因? Performance, architecture, etc?性能、架构等?

UPDATE: From a heroku blog post :更新:来自 heroku 博客文章

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.在 Heroku,我们相信 PostgreSQL 提供了地球上任何 SQL 数据库的强大功能、数据完整性、速度、标准合规性和开源代码的最佳组合。

Postgres is better than mysql in many ways . Postgres 在很多方面都比 mysql You can read these posts about migration rails app from mysql to postgres.您可以阅读这些关于将 rails 应用程序从 mysql 迁移到 postgres 的帖子。 Though mysql is more popular than postgres, but instagram is using postgres maybe due to these reasons.虽然 mysql 比 postgres 更受欢迎,但instagram 使用postgres 可能是由于这些原因。 I feel postgres is much more mature and robust than mysql.我觉得 postgres 比 mysql 更加成熟和健壮。 Whereas mysql is more easy and simple to use.而mysql更容易使用。

Migrating MySQL to PostgreSQL in Rails « mindlev 在 Rails 中将 MySQL 迁移到 PostgreSQL « mindlev

Converting Rails application data from MySQL to PostgreSQL 将 Rails 应用程序数据从 MySQL 转换为 PostgreSQL

For data migration, a handy little script: Rake task to transfer a Rails database, say from MySQL to Postgres and back again对于数据迁移,一个方便的小脚本: Rake task to transfer a Rails database,比如从 MySQL 到 Postgres 再返回

Compare the length of this list of MySQL gotchas to this list of postgresql gotchas .将此MySQL 陷阱列表的长度与postgresql 陷阱列表的长度进行比较。 MySQL is much more likely to mess you up. MySQL 更有可能把你搞砸。

Generally speaking I find pgsql lends itself to 24/7 operations better than mysql.一般来说,我发现 pgsql 比 mysql 更适合 24/7 操作。 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.我认为,如果您更熟悉其中一个,那么这比其他任何事情都更有可能影响您的决定。

Well, performance on Postgres is generally better for complex querys, like the kind generated by ORMs.嗯,Postgres 的性能通常更适合复杂查询,比如 ORM 生成的那种。 Also, postgres just tends to be more "solid".此外,postgres 往往更“可靠”。 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.这是古老的,但我管理的 postgres 服务器总是比 mysql 麻烦得多,mysql 喜欢偶尔随机崩溃,偶尔会在下降过程中损坏表。

I'm moving one of my client's Rails apps from Heroku Postgresql to Mysql (the ClearDB addon) at the moment.我目前正在将我客户的一个 Rails 应用程序从 Heroku Postgresql 迁移到 Mysql(ClearDB 插件)。 PostgreSQL is a stricter and more "correct" database service in many ways, which appears to be why Heroku endorses it. PostgreSQL 在很多方面都是更严格和更“正确”的数据库服务,这似乎是 Heroku 认可它的原因。 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.然而,我发现 Rails 框架或多或少地消除了差异,而且大多数 Rails 应用程序不会增长到足以让 Mysql 的性能问题成为破坏者。

On the other hand, PostgreSQL (in particular Heroku's offering) has a couple sharp disadvantages for a startup app:另一方面,PostgreSQL(尤其是 Heroku 的产品)对于启动应用程序有几个明显的缺点:

  • The price.价格。 To prevent weekly "Database connection lost" errors when working with Heroku Postgres, you have to shell out $200 / month.为了防止在使用 Heroku Postgres 时每周出现“数据库连接丢失”错误,您必须每月支付 200 美元 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.在 ClearDB 上,每月10 美元的计划可以获得 100% 正常运行时间的承诺(我们还没有机会评估此声明),该计划还提供 1 GB 的空间——这超出了我们的需要。
  • 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;在进行 Rails 开发时,我每 5 分钟参考一次schema.rb数据库架构文件,为了保持该文件的整洁和可读性,我发现能够指定应添加列的顺序至关重要。MySQL 支持指定的顺序列; PostgreSQL doesn't. PostgreSQL 没有。 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.在许多情况下,此功能并不重要,但由于 Rails / ActiveRecord 的工作方式,当我无法对列重新排序时,我的生活变得更加艰难。

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:与上述任何建议都不矛盾,但如果出于某种原因你真的想要或需要坚持使用 MySQL,我最近注意到 Heroku 现在提供了一个免费的 MySQL 附加组件,称为 ClearDB:

https://addons.heroku.com/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." Heroku 声称免费版本的正常运行时间为 99.95%(而任何付费版本都声称正常运行时间为 100%),并且他们否认免费版本是“生产就绪”。 They claim ClearDB is "native, unmodified MySQL."他们声称 ClearDB 是“原生的、未经修改的 MySQL”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么Rails中的:id在Postgresql中不起作用,但在MySQL中却起作用? - Why does this :id in Rails not work with Postgresql but it does work with MySQL? 我怎样才能找到为什么我的代码在 localhost 上工作但在 Heroku PostgreSQL 上工作的原因? - How can I find why my code is working on localhost but not working on Heroku PostgreSQL? Heroku错误:请安装postgresql适配器,但我使用的是mysql,所以为什么会看到此错误? - Heroku error: Please install the postgresql adapter but I'm using mysql, so why am I seeing this error? 为什么我的节点应用程序可以运行片刻然后崩溃(heroku)? - why does my node app works for a few moments on and crashes( heroku)? PostgreSQL (Heroku) 中的时间/日期时间比较 - Time/datetime Comparison in PostgreSQL (Heroku) 为什么MySQL不使用索引? - Why does MySQL not use index? 为什么MySQL不使用索引? - Why does MySQL not use the index? Laravel使用PostgreSQL在Heroku中托管项目错误 - Laravel project hosting error in heroku using postgreSQL 如何将MySQL中的布尔值字段迁移到Heroku中的PostgreSQL? - How to migrate a boolean field in MySQL to PostgreSQL in Heroku? 无法在Heroku上迁移数据库(尝试过MySQL和PostgreSQL) - Unable to Migrate Database (tried MySQL and PostgreSQL) on Heroku
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM