Sunday, October 18, 2015

cakephp3 and lots of inserts

Hello,

I have an EventTable which hasMany Images. Each time I insert an event I loop through a folder for jpg images. In each loop I d

$image = $this->Image->newEntity(['code' => $code]);
array_push
($images, $image);



Then outside loop I do

$events->images = $images;


Considering I have more than 10.000 images is this an ideal approach? Database log shows it takes about 1 minute for more than 10.000 inserts while the whole controller actions takes more than 2 minutes ( I guess it's the newEntity call?)
Can I do something else to speed the process?

Thanks

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: