php - Laravel: MASSIVE updateOrCreate() -


i trying export data (nightly) out of archaic system that's little bit easier write code for; however, amount of data being exported massive.

i dumping data json objects , trying updateorcreate() using laravel, have way data. takes 10 hours process of data 2.5 million mysql rows.

i think slow because performing 5 million queries.

does know of example on how efficiently execute massive updateorcreate() using laravel?

probably lot of depends on exact data, try work data packages. first take example 500 data records json, manually run 500 queries verify if data exists.

for exist run update each of them don't exist don't insert them put them array , insert them in bulk this:

db::table('your_table')->insert($records); 

you should make sure don't have many records or less speed process as possible.

in general bulk inserts can speed operations lot depends on data have , exact algorithm of putting data.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -