We are developing an application with a complicated UI in yii. I am not the programmer but noticed that the application page load times seemed slow.
I turned on MySQL query logging and found that there were many instances of repeated queries such as "select x,y,z from table where id = 1", "select x,y,z from table where id = 2", "select x,y,z from table where id = 3". Replacing these with a single "select x,y,z from table where id in (1,2,3)" takes virtually the same duration as running one of the single queries. In aggregate doing so would shave an order of magnitude off the load time. Looks to me like a query is happening within a loop rather than a where clause being constructed first, all data retrieved to an array and then looping through the array.
When I pointed this out to the programming team, I was told that in PHP looping through an array is as slow as doing separate SQL calls. I find this hard to believe given my experience with other programming languages, it looks like DAO would do this easily. The other issue appears to be complex models. Any advice appreciated.