When doing a bulk insert/update/change to a MySQL table you can temporarily disable index updates like this:
ALTER TABLE $tbl_name DISABLE KEYS
ALTER TABLE $tbl_name ENABLE KEYS
From the docs:
ALTER TABLE ... DISABLE KEYStells MySQL to stop updating non-unique indexes.
ALTER TABLE ... ENABLE KEYSthen should be used to re-create missing indexes. MySQL does this with a special algorithm that is much faster than inserting keys one by one, so disabling keys before performing bulk insert operations should give a considerable speedup. Using
ALTER TABLE ... DISABLE KEYSrequires the
INDEXprivilege in addition to the privileges mentioned earlier.
While the non-unique indexes are disabled, they are ignored for statements such as
EXPLAINthat otherwise would use them.