Can anyone tell me if MySQL does indexing for its foreign keys automatically or not?
My MySQL is using MyIsam Engine.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
MyISAM does not support foreign keys at all. From the manual:
This is for MySQL 5.6, the next version, so it is not implemented yet. The text is exactly the same for older versions.
This means that the foreign key construct is not used at all. You can specify it in your
CREATE TABLEcommand but MySQL will silently ignore it. No index will be made out of it, and it won’t be stored (so aSHOW CREATE TABLEcommand will not show that you tried to createa a foreign key).If you need foreign key support, consider using the InnoDB storage engine instead. InnoDB creates indices automatically for foreign keys.