Need to Optimaize
Hi,
I recently did an explain on one of my select statements and got:
---------------------------------------------------------------
table | type | possible_keys | key | key_len | ref | rows | extra
m | ALL | NULL | NULL | NULL | NULL | 207 | using where; using temporary; using filesort
e | ALL | NULL | NULL | NULL | NULL | 618 |
c | ALL | NULL | NULL | NULL | NULL | '127
-------------------------------------------------------------------
from what I have been reading this is the worst possible result from EXPLAIN. so looks like i need to optimize a bunch. here's my query:
---------------------------------------------------------------------------
SELECT m.memblog_id, m.blog_name, m.member_name, m.blog_views, COUNT(DISTINCT(e.entry_id)) AS blog_entries, COUNT(DISTINCT(c.comment_id)) AS blog_comments, MAX(e.entry_time) AS blog_last
FROM memblogs m LEFT JOIN entries e ON m.memblog_id = e.memblog_id LEFT JOIN comments c ON m.memblog_id = c.memblog_id
WHERE m.member_status IN (1, 2)
GROUP BY m.memblog_id
ORDER BY blog_last DESC, m.blog_views DESC, m.blog_name
LIMIT 0, 30
---------------------------------------------------------------------------
im stumped on how to optimize this query because it only joins on unique integer primary keys. what can i do here?
thanks
Subject
Written By
Posted
Need to Optimaize
February 18, 2005 05:25AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.