Is there a MySQL command that can remove all additional indexes except the first in one table, thereby preserving only the main index?
I can remove the second Post_Date index using the following MySQL command, but I have problems with the rest of the rest.
mysql_query("ALTER TABLE $TableName DROP INDEX Post_Date");
Additional Post_Date and Post_Date_x indexes are created at the beginning of the script , so I want to delete them at the end of the script using the MySQL command at the end of the script.
Keep in mind that _x is in Post_Date_x and varies and can go from 1 to 10 or from 1 to 100. Therefore, you may need a loop or IF statement.
MySQL command will be part of a PHP script
Thank you for your time.
Action Keyname Type Unique Packed Column Cardinality Collation Null Comment
Edit Drop PRIMARY BTREE Yes No id 830 A
Edit Drop Post_Date BTREE Yes No Post_Date 830 A
Edit Drop Post_Date_2 BTREE Yes No Post_Date 830 A
Edit Drop Post_Date_3 BTREE Yes No Post_Date 830 A
Edit Drop Post_Date_4 BTREE Yes No Post_Date 830 A
Edit Drop Post_Date_5 BTREE Yes No Post_Date 830 A
Edit Drop Post_Date_6 BTREE Yes No Post_Date 830 A
Edit Drop Post_Date_7 BTREE Yes No Post_Date 830 A
Edit Drop Post_Date_8 BTREE Yes No Post_Date 830 A
source
share