myISAM和InnoDB表的外键

时间:2021-01-23 07:33:41

I have a DB table that is myISAM, used for fulltext searching. I also have a table that is InnoDB. I have a column in my myISAM table that I want to match with a column in my InnoDB table. Can that be done? I cant seem to work it out!

我有一个数据库表是myISAM,用于全文搜索。我还有一张InnoDB表。我的myISAM表中有一列我希望与InnoDB表中的列匹配。可以这样做吗?我似乎无法解决它!

2 个解决方案

#1


12  

http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html

http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html

Foreign keys definitions are subject to the following conditions:

外键定义受以下条件限制:

Both tables must be InnoDB tables and they must not be TEMPORARY tables.

两个表都必须是InnoDB表,它们不能是TEMPORARY表。

So, I'm afraid you wont be able to achieve what you want done.

所以,我担心你无法实现你想做的事情。

#2


3  

I would recommend altering your DB architecture such that you have one set of tables designed with data integrity for writing (all InnoDB), and a second set designed for search - possibly on a different box, and possibly not even using MySQL, but maybe a search server like Solr or Sphinx, which should outperform a fulltext MySQL table. You could then populate your search DB periodically from your write DB.

我建议改变你的数据库架构,使你有一组设计有数据完整性的表(所有InnoDB),第二组设计用于搜索 - 可能在不同的盒子上,甚至可能不使用MySQL,但也许是像Solr或Sphinx这样的搜索服务器,它应该胜过全文MySQL表。然后,您可以定期从写入数据库填充搜索数据库。

#1


12  

http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html

http://dev.mysql.com/doc/refman/5.0/en/innodb-foreign-key-constraints.html

Foreign keys definitions are subject to the following conditions:

外键定义受以下条件限制:

Both tables must be InnoDB tables and they must not be TEMPORARY tables.

两个表都必须是InnoDB表,它们不能是TEMPORARY表。

So, I'm afraid you wont be able to achieve what you want done.

所以,我担心你无法实现你想做的事情。

#2


3  

I would recommend altering your DB architecture such that you have one set of tables designed with data integrity for writing (all InnoDB), and a second set designed for search - possibly on a different box, and possibly not even using MySQL, but maybe a search server like Solr or Sphinx, which should outperform a fulltext MySQL table. You could then populate your search DB periodically from your write DB.

我建议改变你的数据库架构,使你有一组设计有数据完整性的表(所有InnoDB),第二组设计用于搜索 - 可能在不同的盒子上,甚至可能不使用MySQL,但也许是像Solr或Sphinx这样的搜索服务器,它应该胜过全文MySQL表。然后,您可以定期从写入数据库填充搜索数据库。