简体   繁体   中英

How to disable the non-unique indexes globally in MySQL?

I am using a lots of insert on a MySQL database. However, the table that we are inserting into has many indexed. Many of them are not unique but some of them are unique.

So I need to disable only the indexes that are not unique. If that possible to do? I want to set that globally and not locally to a session. The server is test so I know it will slow down all select statements.

If that is not possible then How can I disable all the indexes globally??

Thanks

As far as I know you can disable all indexes, but not individual ones. You may need to remove the indexes you don't want, then add them later.

Another approach is to create an alternate table, hack around with it, and then swap it for the master:

 CREATE TABLE stunt_table LIKE master_table
 INSERT INTO stunt_table SELECT * FROM master_table
 -- (...Any modifications or manipulations...)
 RENAME TABLE master_table TO old_master_table, stunt_table TO master_table

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM