We can use following techniques to optimize INSERT queries in MySQL:
- Values: For inserting multiple rows in a table we can pass multiple VALUES as a list in an INSERT statement. It is faster than using single row INSERT per statement.
- Default: If we have default value set on a column then we should not try to insert default value. We can just insert data with non-default value.
- LOAD_DATA_INFILE: We can use LOAD_DATA_INFILE to insert data from a text file into MySQL.