Page MenuHomePhabricator

Second query of ApiQueryBackLinks filesorts
Closed, ResolvedPublic

Description

Author: Bryan.TongMinh

Description:
See https://wikitech.leuksman.com/index.php?title=Server_admin_log&diff=17574&oldid=17573

An explain on the example query in the code gives:

mysql> EXPLAIN SELECT page_id, page_title, page_namespace, page_is_redirect, pl_title, pl_namespace FROM pagelinks, page WHERE pl_from=page_id AND (pl_title='Foo' AND pl_namespace=0) OR (pl_title='Bar' AND pl_namespace=1) ORDER BY pl_namespace, pl_title, pl_from LIMIT 500;
+----+-------------+-----------+-------+----------------------+--------------+---------+------+----------+-----------------------------------------------------------+

idselect_typetabletypepossible_keyskeykey_lenrefrowsExtra

+----+-------------+-----------+-------+----------------------+--------------+---------+------+----------+-----------------------------------------------------------+

1SIMPLEpagelinksrangepl_from,pl_namespacepl_namespace261NULL557Using where; Using index; Using temporary; Using filesort
1SIMPLEpageALLPRIMARYNULLNULLNULL15734439Using where

+----+-------------+-----------+-------+----------------------+--------------+---------+------+----------+-----------------------------------------------------------+
2 rows in set (0.01 sec)

A filesort of 557 rows does not seem much, but I don't know how the row number is related to the requested page.


Version: 1.14.x
Severity: enhancement

Details

Reference
bz16483

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:23 PM
bzimport set Reference to bz16483.

Fixed in r46134. The query was missing parentheses around the OR, which caused it to mean something different. Adding these parentheses kills the filesort.

(In reply to comment #2)

Release notes not updated.

Re-closing, as release notes aren't what this bug is about. This kind of stuff belongs on CR (where you put it as well; I replied there).