Foreign keys must be Index in mySQL?

后端 未结 3 1099
遥遥无期
遥遥无期 2021-02-14 11:47

I\'ve just created my first mySQL table on my own (other than using Joomla, Wordpress, etc.) and I am MS SQL developer for years but normally I can easily create a foreign key i

3条回答
  •  滥情空心
    2021-02-14 12:20

    Short answer: Yes, MySQL forces you to index foreign key.

    InnoDB requires indexes on foreign keys and referenced keys so that foreign key checks can be fast and not require a table scan.

    You can read more about foreign keys on MySQL documentation pages: http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html

提交回复
热议问题