MySQL-InnoDB与MyISAM [英] MySQL - InnoDB vs MyISAM

查看:75
本文介绍了MySQL-InnoDB与MyISAM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我昨天阅读了以下文章( http://blogs.sitepoint.com/2010/11/19/mysql-mistakes-php-developers/),它写道:

I read the following article yesterday (http://blogs.sitepoint.com/2010/11/19/mysql-mistakes-php-developers/) and it wrote the following:

MySQL有许多数据库引擎,但是您最有可能遇到MyISAM和InnoDB.

MySQL has a number of database engines but you’re most likely to encounter MyISAM and InnoDB.

默认使用MyISAM.但是,除非您要创建一个非常简单或实验性的数据库,否则几乎肯定是错误的选择! MyISAM不支持对数据完整性至关重要的外键约束或事务.此外,每当插入或更新一条记录时,整个表都将被锁定:随着使用量的增长,这会对性能产生不利影响.

MyISAM is used by default. However, unless you’re creating a very simple or experimental database, it’s almost certainly the wrong choice! MyISAM doesn’t support foreign key constraints or transactions which are essential for data integrity. In addition, the whole table is locked whenever a record is inserted or updated: it causes a detrimental effect on performance as usage grows.

解决方案很简单:使用InnoDB.

The solution is simple: use InnoDB.

我一直使用MyISAM,因为它是默认设置.你觉得呢?

I've always used MyISAM because it was the default. What do you think?

如果要升级到InnoDB,请在phpMyAdmin中,我可以只编辑每个表并将其更改为innoDB还是要执行更复杂的过程?

If I were to upgrade to InnoDB, in phpMyAdmin, can I just edit each table and change it to innoDB or is there a more complex process to perform?

谢谢!

推荐答案

是的,如果您愿意,您可以像往常一样穿入和穿出引擎,而不会遇到太多麻烦.只需在phpmyadmin中进行更改即可.

Yes, you can swap in and out engines like used underwear, if you like, without much trouble. Just change it in phpmyadmin.

但是我不会为了更改而更改它.您需要使用外键吗?更改.您是否需要行级锁定而不是表锁定?更改.

But I wouldn't change it for the sake of changing it. Do you need to use foreign keys? Change it. Do you need row-level-locking instead of table-locking? Change it.

值得注意的是,使用MyISAM也有充分的理由.看看FULLTEXT索引.您不能使用InnoDB做到这一点.

It's worth noting that there are good reasons to use MyISAM, too. Take a look at FULLTEXT indexing. You can't do that with InnoDB.

更新

从MySQL 5.6开始,InnoDB表也实现了FULLTEXT.这是手册.

As of MySQL 5.6 FULLTEXT has been implemented for InnoDB tables as well. Here is the manual.

这篇关于MySQL-InnoDB与MyISAM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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