Welcome Guest, Not a member yet? Register   Sign In
Models Remember Vars?
#3

[eluser]JoostV[/eluser]
It seems to me you have written some 'dangerously' repetitive queries in you foreach($ids as $row) loop.

In this loop I see the follwing queries for every $row:
$result = $this->mdl_products->get();
$result = $this->mdl_product_parts->get();
$this->mdl_products->updateCalc(); is probably also a query.

This works fine if you have 10 or so $id-s. But if you have 10.000 $id-s you will run 30.000 queries in one go. Imagine what that will do to your performance. If there is any way to avoid this I would, if I were you.

Also, you attempt to load two models for every $id. Is there a special reason for this? In most cases you can build your app so a model would only have to be loaded once.

Just a thought, mind you :-)


Messages In This Thread
Models Remember Vars? - by El Forum - 11-27-2008, 12:48 PM
Models Remember Vars? - by El Forum - 11-27-2008, 01:46 PM
Models Remember Vars? - by El Forum - 11-28-2008, 03:49 AM
Models Remember Vars? - by El Forum - 11-28-2008, 04:05 AM
Models Remember Vars? - by El Forum - 11-28-2008, 04:25 AM
Models Remember Vars? - by El Forum - 11-28-2008, 04:30 AM
Models Remember Vars? - by El Forum - 11-28-2008, 04:53 AM
Models Remember Vars? - by El Forum - 11-28-2008, 05:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB