简体   繁体   English

myISAM和InnoDB表的外键

[英]Foreign keys for myISAM and InnoDB tables

I have a DB table that is myISAM, used for fulltext searching. 我有一个数据库表是myISAM,用于全文搜索。 I also have a table that is InnoDB. 我还有一张InnoDB表。 I have a column in my myISAM table that I want to match with a column in my InnoDB table. 我的myISAM表中有一列我希望与InnoDB表中的列匹配。 Can that be done? 可以这样做吗? I cant seem to work it out! 我似乎无法解决它!

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. 所以,我担心你无法达到你想要的目标。

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. 我建议改变你的数据库架构,使你有一组设计有数据完整性的表(所有InnoDB),第二组设计用于搜索 - 可能在不同的盒子上,甚至可能不使用MySQL,但也许是搜索服务器,如Solr或Sphinx,它应该胜过全文MySQL表。 You could then populate your search DB periodically from your write DB. 然后,您可以定期从写入数据库填充搜索数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM