mysql - Why InnoDB adds index for foreign key column -
mysql auto adding index when adding foreign key column in mysql innodb engine. primary key enough search rows, how affect performance adding index foreign key column.
thanks in advance.
mysql docs state reasoning behind here
mysql requires indexes on foreign keys , referenced keys foreign key checks can fast , not require table scan. in referencing table, there must index foreign key columns listed first columns in same order. such index created on referencing table automatically if not exist.
there many queries typically joins require rows match on basis of foreign keys , database has find rows. index typically helps faster.
Comments
Post a Comment