https://bugzilla.wikimedia.org/show_bug.cgi?id=24479

--- Comment #17 from Reedy <s...@reedyboy.net> 2010-12-31 20:07:08 UTC ---
mysql> describe SELECT cr_id,cr_repo_id,cr_status,COUNT(DISTINCT cc_id) AS
comments,cr_path,cr_message,cr_author,cr_timestamp FROM `mw_code_tags` FORCE
INDEX (ct_repo_id),`mw_code_rev` LEFT JOIN `mw_code_comment` ON ((cc_repo_id =
cr_repo_id AND cc_rev_id = cr_id)) WHERE cr_repo_id = ct_repo_id AND
(ct_repo_id = '3') AND (cr_id=ct_rev_id) AND ct_tag = 'api' GROUP BY ct_rev_id
ORDER BY ct_rev_id DESC LIMIT 51;
+----+-------------+-----------------+--------+-----------------------------------------+------------+---------+--------------------------------------------------------+------+--------------------------+
| id | select_type | table           | type   | possible_keys                  
        | key        | key_len | ref                                           
        | rows | Extra                    |
+----+-------------+-----------------+--------+-----------------------------------------+------------+---------+--------------------------------------------------------+------+--------------------------+
|  1 | SIMPLE      | mw_code_tags    | ref    | ct_repo_id                     
        | ct_repo_id | 261     | const,const                                   
        |    1 | Using where; Using index |
|  1 | SIMPLE      | mw_code_rev     | eq_ref |
PRIMARY,cr_repo_id,cr_repo_author,cr_id | PRIMARY    | 8       |
const,wikidb.mw_code_tags.ct_rev_id                    |    1 | Using where    
         |
|  1 | SIMPLE      | mw_code_comment | ref    | cc_repo_id,cc_repo_time        
        | cc_repo_id | 8       |
wikidb.mw_code_rev.cr_repo_id,wikidb.mw_code_rev.cr_id |    1 | Using index    
         |
+----+-------------+-----------------+--------+-----------------------------------------+------------+---------+--------------------------------------------------------+------+--------------------------+
3 rows in set (0.00 sec)

mysql> describe SELECT cr_id,cr_repo_id,cr_status,COUNT(DISTINCT cc_id) AS
comments,cr_path,cr_message,cr_author,cr_timestamp FROM `mw_code_tags`,
`mw_code_rev` LEFT JOIN `mw_code_comment` ON ((cc_repo_id = cr_repo_id AND
cc_rev_id = cr_id)) WHERE cr_repo_id = ct_repo_id AND (ct_repo_id = '3') AND
(cr_id=ct_rev_id) AND ct_tag = 'api' GROUP BY ct_rev_id ORDER BY ct_rev_id DESC
LIMIT 51;
+----+-------------+-----------------+--------+-----------------------------------------+------------+---------+--------------------------------------------------------+------+--------------------------+
| id | select_type | table           | type   | possible_keys                  
        | key        | key_len | ref                                           
        | rows | Extra                    |
+----+-------------+-----------------+--------+-----------------------------------------+------------+---------+--------------------------------------------------------+------+--------------------------+
|  1 | SIMPLE      | mw_code_tags    | ref    | PRIMARY,ct_repo_id             
        | PRIMARY    | 4       | const                                         
        |    1 | Using where; Using index |
|  1 | SIMPLE      | mw_code_rev     | eq_ref |
PRIMARY,cr_repo_id,cr_repo_author,cr_id | PRIMARY    | 8       |
const,wikidb.mw_code_tags.ct_rev_id                    |    1 | Using where    
         |
|  1 | SIMPLE      | mw_code_comment | ref    | cc_repo_id,cc_repo_time        
        | cc_repo_id | 8       |
wikidb.mw_code_rev.cr_repo_id,wikidb.mw_code_rev.cr_id |    1 | Using index    
         |
+----+-------------+-----------------+--------+-----------------------------------------+------------+---------+--------------------------------------------------------+------+--------------------------+
3 rows in set (0.00 sec)


Removing the force index, and just changing the order by/group by improves
it...

Coool

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to