If the MySQL table is Tanki, then the primary key will be indexed by the system default.
If the MySQL table is a composite primary key, the system will follow the left alignment principle, such as composite primary key A and B fields and C fields ..., that only a is indexed by default, B and behind are not indexed, because the A field is before the B field, the index follows the left alignment will only set a default index, the query as where a=? or where a=? and b=? As long as there is a in these 2 query conditions, the A index is used, i.e. a, AB, ABC, a ... An index is used as long as there is a, and b, BC, BD, BCD, CD 、... Conditions as long as there is no index, the query will be very slow, the index either in the condition of a band, or the condition of B or C, etc. also build a separate index.
Note: From the top left to the normalization, we will build the table in the future when the most often used in the condition is placed in the front, so that involves the joint primary key to follow the left alignment principle can be used to index the field by default.
MySQL primary key and rule set to index by default