I have a website where users can adopt virtual "pets".  On this page, 
there is a page with some statistics.  One of the statistics listed on 
that page is most popular pet species.  It was taking over 3 seconds to 
load, so I'm trying to optimize it.  I store the pet species in a 
seperate table from pets, an id from the species table is stored in the 
species table.  I used to be putting all of the species in an array by 
looping through the species table, then I would use that array to 
process the id numbers.  In my attempts to optimize, I changed it to a 
multi-table query that looked something like "select count(*) as 
cnt,species.name,pets.species from pets,species where 
species.id=pets.species group by pets.species order by cnt desc limit 
1".  Now, the speed of the page loading is up to 10 seconds!  Was the 
array method the better way?


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to