DB geekery

Oct. 16th, 2002 03:37 pm
nolly: (Default)
[personal profile] nolly
Does anyone have any ideas for speeding up these queries, especially the first one?

mysql> explain select clientID, count(t.testDigest) from tcsTestInfo t, tcsQuestion q, mcqdb m where q.testDigest=t.testDigest and q.questionID=m.ID and m.passage = '1034384208-txjt66' group by clientID;
+-------+--------+---------------+---------+---------+--------------+-------+----------------------------------------------+
| table | type   | possible_keys | key     | key_len | ref          | rows  | Extra                                        |
+-------+--------+---------------+---------+---------+--------------+-------+----------------------------------------------+
| q     | index  | PRIMARY       | PRIMARY |      80 | NULL         | 83652 | Using index; Using temporary; Using filesort |
| t     | eq_ref | PRIMARY       | PRIMARY |      40 | q.testDigest |     1 |                                              |
| m     | eq_ref | PRIMARY       | PRIMARY |      40 | q.questionID |     1 | where used                                   |
+-------+--------+---------------+---------+---------+--------------+-------+----------------------------------------------+
3 rows in set (0.00 sec)

mysql> explain select t.testDigest, testName, questionID from tcsTestInfo t, tcsQuestion q, mcqdb m where t.testDigest=q.testDigest and q.questionID=m.ID and m.passage = '1034384208-txjt66' and clientID = 'darkmatter';
+-------+--------+---------------+---------+---------+--------------+-------+-------------+
| table | type   | possible_keys | key     | key_len | ref          | rows  | Extra       |
+-------+--------+---------------+---------+---------+--------------+-------+-------------+
| q     | index  | PRIMARY       | PRIMARY |      80 | NULL         | 83652 | Using index |
| t     | eq_ref | PRIMARY       | PRIMARY |      40 | q.testDigest |     1 | where used  |
| m     | eq_ref | PRIMARY       | PRIMARY |      40 | q.questionID |     1 | where used  |
+-------+--------+---------------+---------+---------+--------------+-------+-------------+
3 rows in set (0.00 sec)

Hmmm...

Date: 2002-10-16 09:31 pm (UTC)
From: [identity profile] jhulten.livejournal.com
Without a little more information on how the tablespace is constructed I do think I will be much help.

Profile

nolly: (Default)
nolly

December 2011

S M T W T F S
     123
45678910
11121314 151617
18192021 222324
25262728293031

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 25th, 2026 10:01 pm
Powered by Dreamwidth Studios