You are viewing an archive of Victory Road.
Victory Road closed on January 8, 2018. Thank you for making us a part of your lives since 2006! Please read this thread for details if you missed it.
Being a relative n00b at SQL, optimization has never been my thing. Its complicated, its usually limited in applicable scenarios, and frankly its time consuming. Of course, eventually SQL optimization is a must, but there's one cheater's solution before you come to that road: SQL indexes. Using an index, or two or three indexes, allows much faster execution of common queries all across the board. In an example today:
SELECT COUNT(op.id) AS total_adopts, SUM(op.clicks) AS clicks, sum(op.views) AS views, user.username, user.userid FROM zf_ownedPokemon AS op, user WHERE op.owner = user.userid GROUP BY op.owner ORDER BY total_adopts DESC LIMIT 30