Author: bugzilla_wikipedia_org.to.jamesd
Description:
Special:Ancientpages has a field "UNIX_TIMESTAMP(cur_timestamp) as value" and
orders by "value". There is no value field in the database so the cur_timestamp
indec in cur can't be used. unix_timestamp and cur_timestamp appear to have the
same order so the query should be changed to order by cur_timestamp insted of by
value. Change from:
EXPLAIN SELECT 'Ancientpages' as type, cur_namespace as namespace, cur_title as
title, UNIX_TIMESTAMP(cur_timestamp) as value FROM cur USE INDEX (cur_timestamp)
WHERE cur_namespace=0 AND cur_is_redirect=0 ORDER BY value LIMIT 1350,250:
- row 1 *** table: cur type: ALL possible_keys: NULL key: NULL key_len: NULL ref: NULL rows: 382867 Extra: Using where; Using filesort
To:
EXPLAIN SELECT 'Ancientpages' as type, cur_namespace as namespace, cur_title as
title, UNIX_TIMESTAMP(cur_timestamp) as value FROM cur USE INDEX (cur_timestamp)
WHERE cur_namespace=0 AND cur_is_redirect=0 ORDER BY cur_timestamp LIMIT 1350,250:
- row 1 *** table: cur type: index possible_keys: NULL key: cur_timestamp key_len: 14 ref: NULL rows: 280120 Extra: Using where;
No filesort this time - the key is now being used. This avoids the need to scan
all of cur.
Version: 1.3.x
Severity: normal