Summary on whether the secondary index of MySQL InnoDB table is added to the primary key
1. There is also a clear official statement on whether to add primary keys to the secondary index of MySQL InnoDB table. It is recommended that all columns of primary keys be forcibly added when the secondary index of online MySQL is created, so that all MySQL versions can be unified.
Prior to 2.MySQL 5.6.9, the InnoDB engine layer automatically extended the secondary index, but the optimizer did not recognize the extended primary key.
Since 3.MySQL 5.6.9, the InnoDB engine layer will automatically extend the secondary index, and the optimizer can recognize the extended primary key.
4. The size of the index is the same, whether the secondary index adds the primary key column or not, the secondary index in the InnoDB engine layer will automatically expand the primary key, which has nothing to do with the version.
5. With or without primary key columns, the organizational structure and physical size of the secondary index are the same, because the organizational structure is the same at the storage engine level.
6. This can also be done independent of the version, so that all MySQL versions are unified.