Hello,

I'm trying to create some summary data using some existing InnoDB tables
and I'm running into performance issues. Here is the query:

select topicx, count(*) from BillVote t1 left join BillVotestudentRelation
t3 on t1.mvcoid=t3.idstudent_p left join Student t2 on
t3.idstudent_c=t2.mvcoid left join BillVotebillRelation t5 on
t1.mvcoid=t5.idbill_p left join Bill t4 on t5.idbill_c=t4.mvcoid where
(((t2.usernamex)=(?) and (t4.committeeStatusx)=('P'))) group by topicx

The MySQL EXPLAIN command provided the following information:

+-------+--------+--------------------------------------------------+---------+---------+----------------+-------+----------------------------------------------+
| table | type   | possible_keys                                    | key
| key_len | ref            | rows  | Extra
|
+-------+--------+--------------------------------------------------+---------+---------+----------------+-------+----------------------------------------------+
| t1    | index  | NULL                                             |
PRIMARY |      32 | NULL           | 33297 | Using index; Using temporary;
Using filesort |
| t3    | ref    | PRIMARY                                          |
PRIMARY |      32 | t1.mvcoid      |     1 | Using index
|
| t2    | eq_ref | PRIMARY,usernamex                                |
PRIMARY |      32 | t3.idstudent_c |     1 | Using where
|
| t5    | ref    | PRIMARY                                          |
PRIMARY |      32 | t1.mvcoid      |     1 | Using index
|
| t4    | eq_ref | PRIMARY,committeeStatusx,committeeStatusx_topicx |
PRIMARY |      32 | t5.idbill_c    |     1 | Using where
|
+-------+--------+--------------------------------------------------+---------+---------+----------------+-------+----------------------------------------------+

Is there an index I can add to improve the performance of this query? Any
help would be greatly appreciated.

Thanks.

Jeff Gunther


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

Reply via email to