Page MenuHomePhabricator

Add 'toponly' to recentchanges API module
Closed, ResolvedPublic

Description

Having it in usercontribs (bug 4597, bug 26873) is nice, but for fighting vandalism it would be very useful to have in the recentchanges module as well.

Not sure how friendly this is with effeciency (indexes), but if it's not a problem I think this is a good idea to implement.


Version: 1.18.x
Severity: enhancement

Details

Reference
bz28455

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:35 PM
bzimport set Reference to bz28455.

tracking to bug 22744, maybe someone has time to look at the indices.

Indexes are fine query wise, and it's also done in core.

Fixed in r85771

(In reply to comment #2)

Indexes are fine query wise, and it's also done in core.

Fixed in r85771

Well the queries aren't exactly great in some cases - aka http://en.wikipedia.org/w/index.php?title=Special:Contributions&dir=prev&limit=500&contribs=user&target=SmackBot&topOnly=1 isn't good.

http://192.168.0.190/w/api.php?action=query&list=usercontribs&ucuser=Reedy

mysql> EXPLAIN SELECT /* ApiQueryContributions::execute Reedy */ rev_timestamp,page_namespace,page_title,rev_user,rev_user_text,rev_deleted,rev_page,rev_id,page_latest,rev_comment,rev_len,rev_minor_edit,rev_parent_id FROM mw_page,mw_revision FORCE INDEX (usertext_timestamp) WHERE (page_id=rev_page) AND ((rev_deleted & 4) = 0) AND rev_user_text = 'Reedy' ORDER BY rev_timestamp DESC LIMIT 11;
+----+-------------+-------------+--------+--------------------+--------------------+---------+-----------------------------+------+-------------+

idselect_typetabletypepossible_keyskeykey_lenrefrowsExtra

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

1SIMPLEmw_revisionrefusertext_timestampusertext_timestamp257const26Using where
1SIMPLEmw_pageeq_refPRIMARYPRIMARY4wikidb.mw_revision.rev_page1

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

http://192.168.0.190/w/api.php?action=query&list=usercontribs&ucuser=Reedy&uctoponly

mysql> EXPLAIN SELECT /* ApiQueryContributions::execute Reedy */ rev_timestamp,page_namespace,page_title,rev_user,rev_user_text,rev_deleted,rev_page,rev_id,page_latest,rev_comment,rev_len,rev_minor_edit,rev_parent_id FROM mw_page,mw_revision FORCE INDEX (usertext_timestamp) WHERE (page_id=rev_page) AND ((rev_deleted & 4) = 0) AND rev_user_text = 'Reedy' AND (rev_id = page_latest) ORDER BY rev_timestamp DESC LIMIT 11

-> ;

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

idselect_typetabletypepossible_keyskeykey_lenrefrowsExtra

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

1SIMPLEmw_revisionrefusertext_timestampusertext_timestamp257const26Using where
1SIMPLEmw_pageeq_refPRIMARYPRIMARY4wikidb.mw_revision.rev_page1Using where

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

http://192.168.0.190/w/api.php?action=query&list=usercontribs&ucuser=Reedy&uctoponly&ucdir=newer

mysql> EXPLAIN SELECT /* ApiQueryContributions::execute Reedy */ rev_timestamp,page_namespace,page_title,rev_user,rev_user_text,rev_deleted,rev_page,rev_id,page_latest,rev_comment,rev_len,rev_minor_edit,rev_parent_id FROM mw_page,mw_revision FORCE INDEX (usertext_timestamp) WHERE (page_id=rev_page) AND ((rev_deleted & 4) = 0) AND rev_user_text = 'Reedy' AND (rev_id = page_latest) ORDER BY rev_timestamp LIMIT 11

-> ;

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

idselect_typetabletypepossible_keyskeykey_lenrefrowsExtra

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

1SIMPLEmw_revisionrefusertext_timestampusertext_timestamp257const26Using where
1SIMPLEmw_pageeq_refPRIMARYPRIMARY4wikidb.mw_revision.rev_page1Using where

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

On a limited set it's ok... Slow queries are slow