Actions

Talk

Developer Area/How to Review Code

From Mahara Wiki

Revision as of 10:05, 15 July 2013 by Aaronw (talk | contribs)

Hi,

I am a bit confused as to what a 'si query' is in the line: 'Watch out for queries inside loops (do it outside the loop all at once in a si query)' .

I have tried several searches but have drawn a blank.

Kevin

That's a typo. It should say "in a single query". As in, rather than doing a loop over the ids (1,2,3,5) in which you do "select owner from view where id=?" four times, it's more efficient to do one query, "select owner from view where id in (1,2,3,5)" and then loop over the results. Although in practice, this kind of optimization only tends to have a noticeable effect on "bulk" pages where you're processing at least 100 of something.
Also, you'll probably get a quicker response if you post your questions in the mahara.org forums, or our IRC channel, #mahara-dev or freenode. --aaronw 22:05, 14 July 2013 (UTC)