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

--- Comment #8 from Reedy <s...@reedyboy.net> 2010-12-31 06:00:11 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`,`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 = '3' AND (ct_repo_id =
'3') AND (cr_id=ct_rev_id) AND ct_tag = 'api' 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 | PRIMARY    | 8       |
const,wikidb.mw_code_tags.ct_rev_id                    |    1 |                
         |
|  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 = '3' AND (ct_repo_id =
'3') AND (cr_id=ct_rev_id) AND ct_tag = 'api' GROUP BY cr_id ORDER BY cr_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; Using temporary; Using filesort |
|  1 | SIMPLE      | mw_code_rev     | eq_ref |
PRIMARY,cr_repo_id,cr_repo_author | PRIMARY    | 8       |
const,wikidb.mw_code_tags.ct_rev_id                    |    1 |                
                                          |
|  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 = '3' AND (ct_repo_id =
'3') AND (cr_id=ct_rev_id) AND ct_tag = 'api' ORDER BY cr_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; Using temporary |
|  1 | SIMPLE      | mw_code_rev     | eq_ref |
PRIMARY,cr_repo_id,cr_repo_author | PRIMARY    | 8       |
const,wikidb.mw_code_tags.ct_rev_id                    |    1 |                
                          |
|  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    
                          |
+----+-------------+-----------------+--------+-----------------------------------+------------+---------+--------------------------------------------------------+------+-------------------------------------------+

Order BY only uses temporary
Group By (With/without order by) uses temporary and file sorts

-- 
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