Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low performance with not too big insert datas #31

Open
n0099 opened this issue Nov 21, 2018 · 0 comments
Open

Low performance with not too big insert datas #31

n0099 opened this issue Nov 21, 2018 · 0 comments

Comments

@n0099
Copy link

n0099 commented Nov 21, 2018

Here's a test to fetch 500 rows which has 20 columns from a table, then insert them back without any changes:

$datas = App\SomeModel->limit(500)->get()->toArray();
App\SomeModel::insertOnDuplicateKey($datas);

The laravel-debugbar's timeline shows that inserting data spend ~250ms to excute while the insert sql just excute for ~30ms

It's seems that the ~200ms overheads comes from excuting Connection->affectingStatement(): https://github.com/illuminate/database/blob/0e126944cf0fb3da8fa456fefc34dcf65e80181d/Connection.php#L469 and it's just doing PDO value binding then to excute them.

So does this overheads produced by PDO or the Eloquent itself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant