php - Fastly insert 200+ data to the tables with relationship - Laravel 5.6

one text

Solution:

Suggestion:

Gather the 200 rows into a separate table (perhaps a TEMPORARY table). Then massage the values as needed while in this table. Some (all?) of the massaging can be done in bulk; that is, all 200 rows at the same time. If you need to "normalize" (turn some strings into ids) this is a good time to do that.

Then, as a final step do a single INSERT INTO real SELECT ... FROM temp to put them where they belong.

Source