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)
This account has disabled anonymous posting.
(will be screened if not on Access List)
(will be screened if not on Access List)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org

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 11:15 pm
Powered by Dreamwidth Studios