Pregunta

I have multiple files with a massive amount of SQL data.

The data in the files are stored as a SQL insert command. By running just a benchmark example of 650 records takes about 35 sec (the entire set of files contains more than 500k records)

How can I speed up the script ? I known that, by using a single insert for multiple records would speed up a lot the script but that would require me to parse the files (they are supplied to me already as single SQL insert per record).

Is there any argument or flag to tell mysql to batch insert the entire script ?

¿Fue útil?

Solución

Read this thread: MySQL disable & enable keys

The idea is to disable checks:

SET AUTOCOMMIT = 0; 
SET FOREIGN_KEY_CHECKS = 0; 
SET UNIQUE_CHECKS = 0;
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top