Loading Slow
Posted: Thu Mar 25, 2010 2:44 pm
I have a query that is used to create a dropdown, which returns roughly 4,000 rows (I am only pulling 3 fields back). The query itself runs in about .5 seconds, but when run on the page, it adds 20-25 seconds to the page load time.
NOTE: I have also tried putting "(user_partner.userid = '9' OR user_partner.userid = '12')" as part of the WHERE clause, I also tried "FROM lead, user_partner" instead of a LEFT JOIN... They all seem to have the same load time (give or take 5 econds).
This query should not take that long to load (I don't think), so I guess I am looking for some tips/general knowledge that I may be missing.
Bonus Question: Would storing the results in a session variable be a bad idea? That way, the data is called once, then doesn't need to be called again.
Code: Select all
SELECT leadid, firstname, lastname
FROM lead
LEFT JOIN user_partner ON user_partner.userid = lead.affiliateid AND (user_partner.userid = '9' OR user_partner.userid = '12')
GROUP BY leadid
ORDER BY lastname
This query should not take that long to load (I don't think), so I guess I am looking for some tips/general knowledge that I may be missing.
Bonus Question: Would storing the results in a session variable be a bad idea? That way, the data is called once, then doesn't need to be called again.