为什么 MySQL 的 MyISAM 引擎不支持外键? [英] Why doesn't MySQL's MyISAM engine support Foreign keys?

查看:68
本文介绍了为什么 MySQL 的 MyISAM 引擎不支持外键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的研究编写一个网络应用程序,其中包括全文搜索和外键.

I am writing a web-app for my studies which includes fulltext search and foreign keys.

我在某处看过,MyISAM 引擎适合全文搜索,InnoDB 适合外键.

I have read somewhere, MyISAM engine is suitable for fulltext searching, and InnoDB for foreign keys.

在这种情况下,我应该使用什么引擎才能获得最佳性能?

In this situation what engine should I use for the best performance?

  • 为什么 MyISAM 不支持外键关系,而 InnoDB 支持?
  • 为什么 MyISAM 支持全文搜索而 InnoDB 不支持?

推荐答案

请告诉我,在这种情况下,我必须使用什么引擎来提高性能?

Kindly tell me, In this situation what engine I have to use for improve performance?

每个存储引擎的性能将取决于您执行的查询.但是,请注意同一数据库中的不同表可以使用不同的存储引擎.

The performance of each storage engine will depend on the queries you perform. However, be aware that different tables within the same database can use different storage engines.

为什么 MyISAM 引擎不支持外键关系而 InnoDB 支持?

Why MyISAM engine does not support foreign key relationship and InnoDB does?

外键差异所述:

在稍后阶段,也会为 MyISAM 表实现外键约束.

At a later stage, foreign key constraints will be implemented for MyISAM tables as well.

因此,MyISAM 中还没有实现外键约束.

Therefore, foreign key constraints have simply not yet been implemented in MyISAM.

编辑:由于该注释已从文档中删除,因此似乎不再计划在 MyISAM 引擎中实现外键约束.

EDIT: As that comment is removed from docs, it appears that it is no longer planned to implement foreign key constraints in MyISAM engine.

为什么 MyISAM 引擎支持全文搜索而 InnoDB 不支持?

Why MyISAM engine does support full text search and InnoDB does not?

MySQL 5.6 中的新功能所述:

您可以在 InnoDB 表上创建 FULLTEXT 索引,并使用 MATCH() ... AGAINST 语法.

You can create FULLTEXT indexes on InnoDB tables, and query them using the MATCH() ... AGAINST syntax.

因此,从 MySQL 5.6 开始,InnoDB 已经实现了全文搜索.

Therefore, full text search has been implemented in InnoDB as of MySQL 5.6.

这篇关于为什么 MySQL 的 MyISAM 引擎不支持外键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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