从 MySQL 迁移到 PostgreSQL
我们目前正在将 MySQL 用于我们正在构建的产品,并且热衷于尽快迁移到 PostgreSQL,主要是出于许可原因。
还有其他人做过这样的举动吗? 我们的数据库是应用程序的命脉,最终将存储 TB 级的数据,因此我很想了解性能改进/损失的经验、转换 SQL 和存储过程的主要障碍等。
编辑:只是为了向这些人澄清有人问我们为什么不喜欢 MySQL 的许可。 我们正在开发一款商业产品(目前)依赖 MySQL 作为数据库后端。 他们的许可证规定,我们需要向他们支付每次安装标价的一定比例,而不是固定费用。 作为一家初创公司,这不太有吸引力。
We are currently using MySQL for a product we are building, and are keen to move to PostgreSQL as soon as possible, primarily for licensing reasons.
Has anyone else done such a move? Our database is the lifeblood of the application and will eventually be storing TBs of data, so I'm keen to hear about experiences of performance improvements/losses, major hurdles in converting SQL and stored procedures, etc.
Edit: Just to clarify to those who have asked why we don't like MySQL's licensing. We are developing a commercial product which (currently) depends on MySQL as a database back-end. Their license states we need to pay them a percentage of our list price per installation, and not a flat fee. As a startup, this is less than appealing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我们从 MySQL3 迁移到 PostgreSQL 8.2,然后是 8.3。 PostgreSQL 具有 SQL 的基础知识以及更多功能,因此如果您的 MYSQL 不使用花哨的 MySQL 内容,您会没事的。
根据我的经验,我们的 MySQL 数据库(版本 3)没有外键...PostgreSQL 允许您拥有它们,所以我们必须更改它...这是一件好事,我们发现了一些错误。
我们必须更改的另一件事是编码 (C#) 连接器与 MySQL 中的不同。 MySQL 比 PostgreSQL 更稳定。 我们对 PostgreSQL 仍然没有什么问题。
We did a move from a MySQL3 to PostgreSQL 8.2 then 8.3. PostgreSQL has the basic of SQL and a lot more so if your MYSQL do not use fancy MySQL stuff you will be OK.
From my experience, our MySQL database (version 3) doesn't have Foreign Key... PostgreSQL lets you have them, so we had to change that... and it was a good thing and we found some mistake.
The other thing that we had to change was the coding (C#) connector that wasn't the same in MySQL. The MySQL one was more stable than the PostgreSQL one. We still have few problems with the PostgreSQL one.
我也做了类似的转换,但出于不同的原因。 这是因为我们需要更好的 ACID 支持,并且能够让 Web 用户通过其他数据库工具看到相同的数据(两者都用一个 ID)。
以下是令我们困扰的事情:
与 PostgreSQL 一样严格。
合规性可能是一个问题。
也就是说,一旦安装到位并经过测试,情况就会好得多。 由于安全原因和大量并发使用而正确锁定,PostgreSQL 的性能优于 MySQL。 在不需要锁定(只读)的情况下,性能不太好,但它仍然比网卡快,所以这不是问题。
提示:
目录是一个很好的起点
为了您的转换,但需要
平时要稍微触碰一下。
使用可序列化隔离
级别作为默认值。
真正看到你的数据结构和
帮助找到您的任何关系
忘记定义和执行。
I have done a similar conversion, but for different reasons. It was because we needed better ACID support, and the ability to have web users see the same data they could via other DB tools (one ID for both).
Here are the things that bit us:
as strictly as PostgreSQL.
compliance may be an issue.
That said, once it was in place and tested, it was much nicer. With correct locking for safety reasons and heavy concurrent use, PostgreSQL performed better than MySQL. On the things where locking was not needed (read only) the performance was not quite as good, but it was still faster than the network card, so it was not an issue.
Tips:
directory are a good starting point
for your conversion, but will need
to be touched a little usually.
use the serializable isolation
level as a default.
really see your data structures and
help find any relationships you
forgot to define and enforce.
Steve,我不得不迁移我的旧应用程序,即 PgSQL->MySQL。 我必须说,你应该认为自己很幸运;-)
常见的问题是:
我希望至少有一点帮助。 祝您使用 Postgres 充满乐趣!
Steve, I had to migrate my old application the way around, that is PgSQL->MySQL. I must say, you should consider yourself lucky ;-)
Common gotchas are:
I hope that helps at least a bit. Have lots of fun playing with Postgres!