Avatar of andieje
andieje

asked on 

speed up master detail inserts

Hi

Is there anyway to speed up master detail inserts if the master table has an autoinc primary key.

Is there a better way than this:

START TRANSACTION;
NSERT master (field1,field2) VALUES (data1,data2);
INSERTdetail (foreign_key, field1,field2) VALUES (last_insert_id(), data3,data4);
INSERTmaster (field1,field2) VALUES (data5,data6);
INSERT detail (foreign_key,field1,field2) VALUES (LAST_INSERT_ID,data7,data8);
COMMIT;

IS there a way of using mysqlimport or load data file for master detail data in separate tab files when the master table has an autoinc primary key?

thanks
MySQL Server

Avatar of undefined
Last Comment
andieje

8/22/2022 - Mon