简体   繁体   中英

MySql Index and constraints

I need to drop all indexes and constraints and do some processing, after thar I have to apply same indexes and constraints again using MYSql.Please help.

Please suggest if there is some way to store the information/metadata of index created.

Start by disabling all constraints:

 ALTER TABLE my_tbl NOCHECK CONSTRAINT ALL

Primary keys and unique constraints can't be disabled.

Then reenable them again:

 ALTER TABLE my_tbl WITH CHECK CHECK CONSTRAINT ALL

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