且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将php4/mysql4迁移到php5/mysql5:切换到InnoDB吗?

更新时间:2023-01-31 17:44:25

将MySQL v4/v5升级与表升级分开是值得的.这样可以减少潜在的问题范围.

It is worthwhile separating the MySQL v4/v5 upgrade from the table upgrades. That reduces the potential range of problems.

也就是说,如果很少发生重启数据库的情况,那么在v4/v5升级之前要花一些时间检查InnoDB服务器选项,因为它们中的许多都需要重启数据库.推荐的两个参数是innodb_file_per_table = 1和innodb_flush_log_at_tx_commit = 1(查找它们),您还应该查看innodb_buffer_pool_size,因为如果没有人更改它,几乎肯定会太低.

That said, if restarting the database is a rare occurance, then take some time to review the InnoDB server options before the v4/v5 upgrade, anyway, because many of them need a database restart. The two recommended are innodb_file_per_table=1 and innodb_flush_log_at_tx_commit=1 (look them up) and you should also look at innodb_buffer_pool_size, as it is almost certainly going to be too low if no-one has changed it.

MyISAM将存在很长时间.它是一种非常健壮的磁盘格式,具有一些在许多情况下有用的品质.特别是,它具有快速的SELECT,这对于没有更新或更新很少的小表很有用.也就是说,由于MyISAM不支持并发读取,因此非常热的表(很多SELECT s)将受益于迁移到InnoDB.

MyISAM is going to be around for a long time. It is a very robust on-disk format that has some qualities useful for many situations. In particular, it has a fast SELECT which can be useful for a smallish table that has no or very few updates. That said, a very hot table (lots and lots of SELECTs) will benefit from being migrated to InnoDB because MyISAM does not support concurrent read.

MyISAM几乎总是能够在数据库崩溃后幸存下来,只需要一个REPAIR TABLE. InnoDB并不总是那么幸运. MyISAM也可以从数据库下面备份;即使您没有事先锁定表,也很可能会得到一个可以正常使用的文件. InnoDB文件不是很友好.这就是为什么innodb_hot_copy存在的原因.

MyISAM almost always survives a database crash with nothing more than a REPAIR TABLE needed. InnoDB is not always so lucky. The MyISAM can also be backed-up out from under the database; even if you don't lock the table beforehand, you will very likely get a file that will just work. InnoDB files are not so kind; this is why innodb_hot_copy exists.

我们最近进行了MySQL v4/v5升级,但只有一个SQL问题:混合模式JOIN.当将隐式表联接与显式的LEFT JOIN子句混合使用时,版本4的解析器是相当宽容的.版本5并不是那么宽容.因此,我们借此机会搜寻了该应用程序并将所有JOIN升级到显式的JOIN.除了错过一两个景点外,这次活动非常成功.

We recently went through a MySQL v4/v5 upgrade and we only had one SQL problem: mixed-mode JOINs. Version 4's parser was fairly forgiving when mixing implicit table joins with explicit LEFT JOIN clauses. Version 5 is not so forgiving. So we took the opportunity to scour the app and upgrade all the JOINs to explicit JOINs. Apart from one or two spots that were missed, this was very successful.

我建议您使用与MySQL v5通讯的PHP 4设置测试环境.这将让您测试所有这些.

I'd recommend you setup a test environment with PHP 4 talking to MySQL v5. This will let you test all this out.