Misunderstanding statement in MySQL documentation I can't understand this statement in Optimizing Data Size:


  Declare columns with identical information in different tables with
  identical data types, to speed up joins based on the corresponding
  columns.


Can anyone describe this statement with example?
If you need to JOIN or compare columns, then ensure they are the same datatype. This avoids implicit conversions which usually invalidate index usage.

However, for JOINs especially this can be completely prevented by defining a foreign key constraint: this forces you to have the same datatype. See MySQL docs which says:


  Corresponding columns in the foreign key and the referenced key must have similar data types. The size and sign of integer types must be the same. The length of string types need not be the same. For nonbinary (character) string columns, the character set and collation must be the same