Thanks Christoph for your insightful reply. You're right. I'm using 4 nested for each loops with a few select queries in each loop. I will try to make a join query and then loop through the returned result array. As I understand from your reply that should make the page load faster and put a lot less load on the mysql server.
ChristophDorn wrote: > > bytte wrote: >> Hey that was interesting. I have the indexes defined and I see though >> Firebug >> that there's currently 381 queries being performed at 0.14949 seconds. I >> guess that means they're not the culprit? >> > 381 DB queries is a lot of queries for a single web page. Even if they > only take 0.15 seconds combined, they will bring your DB server to it's > knees as soon as you start putting some traffic through that page and > other pages using the same DB. > > You are likely running DB queries in a loop which is not good practice. > You should be using the "IN" SQL clause or use joins. It is much faster > to add some more loops to your PHP than to run DB queries. If this page > is going to be run a lot I would even check if you need to fetch the > data from the DB on every page request or if you can cache some > semi-static data. > > > -- > Christoph Dorn > <http://www.ChristophDorn.com/> http://www.ChristophDorn.com/ > > > -- View this message in context: http://www.nabble.com/Best-coding-practice--Form-takes-too-long-to-load-now.-tp22309252p22413665.html Sent from the Zend Framework mailing list archive at Nabble.com.