sql - MySQL foreign key question -


Does any foreign key also define an index that defines? I have mysql v5.1.46 & amp; I'm looking at the MySQL Administrator tool and it shows the foreign key as its index, so I want to confirm it?

  • If there is already a useful index (an index where the foreign key column has the same order Are listed in the first column) then a new index is not created.
  • If there is no useful indicator, then it also creates an index by creating a foreign key.

This includes.

InnoDB needs to be indexed on the foreign key and the referenced key, that foreign key check can be faster and a table scan is not required, in the referenced table, there should be an indicator where Foreign key columns are listed in the same order as the first column. Such index is automatically generated on the referenced table if it does not exist. (This is in contrast to some older versions, in which the index was to be made explicitly or the construction of foreign key constraints could have failed.) Index_name, if given, is used as the first described


Comments