DROPPRIMAYDEY is used to cancel the primary index. Note: in earlier versions of MySQL, if there is no primary index, DROPPRIMARYKEY will cancel the first UNIQUE index in the table. This does not happen in MySQL5.1. If you use dr drop primay dey to cancel a primary index for a table without a primary key in MySQL5.1.
Note: in earlier versions of MySQL, if there is no PRIMARY index, drop primary key will cancel the first UNIQUE index in the table. This does not happen in MySQL 5.1. If you use drop primary key for a table without a primary key in MySQL 5.1, an error message is displayed.
If you add a unique key or primary key to the table, the unique key or primary key is stored before a non-UNIQUE index, so that MySQL can check duplicate keywords as soon as possible.
Order by is used to sort the rows in a certain ORDER when creating a new table. Note: After insertion and deletion, the table will not remain in this order. You can use this option when you know that you will query rows in a specific order in most cases. after making a major change to the table, you can use this option, you can improve query efficiency. In some cases, sorting by column may be easier for MySQL.
If you use alter table for a MyISAM TABLE, all non-unique indexes are created in a separate batch (the same as the repair table ). When you have many indexes, this can make alter table faster.
This function can be explicitly activated. Alter table... disable keys: stop MySQL from updating non-unique indexes in the MyISAM TABLE. Then use alter table... enable keys to recreate the lost index. During this operation, MySQL uses a special algorithm, which is much faster than inserting keywords one by one. Therefore, disabling keywords before batch insertion can greatly speed up. Using alter table... disable keys requires the INDEX permission in addition to the previously mentioned permissions.