View Single Post
  #3  
Old 05-09-2010, 01:51 AM
Arianna's Avatar
Arianna Arianna is offline
Dev Staff
 
Join Date: Sep 2009
Posts: 334
Gender: Female
Credits: 21,602
Arianna will become famous soon enough
Default RE: Anyone care to enlighten me as to why 188 queries are used on a page?

I don't have any additional mods installed, and after going through the script I realized that it was selecting every single adoptable (select * from adoptables) and only then checking (with three queries a piece, of course) if it could be adopted.

I think that the problem is, generally, is that for every adoptable it is calling canadopt($aid, "showing", $promocode), which is 3 queries a piece. As for myadopts, the problem is getcurrentimage($id), because this takes a query per pet. I'm working on editing the code now, but since I have so many modifications already (to reduce queries :P) I'm not sure I'll share it.

The query tracking was done by me, but it's really simple - $query_list[] = $query; $query_count++; is inserted after every query (regexes were helpful for putting them in) and when I show the page, I echo all of them. A page without any additional queries is 6 queries, 5 of which are 'select * from users where username = {$username}'. xP
Reply With Quote