this query runs slow because AVG and COUNT on maps_rating table i think.
can anything be done to improve?

query:

SELECT
maps.*, AVG(maps_rating.rating) AS rating, COUNT(maps_rating.id) AS votes, user.username
FROM maps
LEFT JOIN maps_rating ON (maps.id = maps_rating.map)
LEFT JOIN user ON (user.userid = maps.userid)
GROUP BY maps.id ORDER BY maps.dateline DESC LIMIT $start, $perpage

structure:

maps - rows: 700
+--+----+-----+-------+--------+--------+
| id | mip | map | userid | author | filename |
+--+----+-----+-------+--------+--------+


maps_rating - rows: 2,000
+--+-----+------+--------+-----------+-------+
| id | map | rating | userid | ipaddress | dateline |
+--+-----+------+--------+-----------+-------+


user - rows: 10,000
+------+-----------+
| userid | username |
+------+-----------+


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.10.5/67 - Release Date: 8/9/2005


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to