Martin
Martin

Reputation: 76

Is it possible to builk insert ignore / insert or update with eloquent or query builder in Laravel 5.8? Without looping each record?

Im generating a lot of data that i would like to store in DB, sometime part of data that i would store already exists in DB. How can i insert bulk amount of records without looping them all?

Upvotes: 2

Views: 271

Answers (2)

Volod
Volod

Reputation: 1437

You can use DB::statement('Your raw SQL query here')

Upvotes: 0

Yusdiel Rodriguez
Yusdiel Rodriguez

Reputation: 76

I am walking for this problem before, I have like 3000k of the row to insert in MySQL so the only reasonable way that I can resolve this problem was with:

LOAD DATA LOCAL INFILE

Upvotes: 1

Related Questions