Last modified: 2014-02-18 20:35:04 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T61988, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 59988 - ActiveUsersPager query expensive when specifying a starting rc_user_text value
ActiveUsersPager query expensive when specifying a starting rc_user_text value
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Special pages (Other open bugs)
1.23.0
All All
: High normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: performance
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-01-13 07:46 UTC by Sean Pringle
Modified: 2014-02-18 20:35 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Sean Pringle 2014-01-13 07:46:21 UTC
ActiveUsersPager generates a query like this when a user name is supplied as a starting value:

SELECT /* IndexPager::buildQueryInfo (ActiveUsersPager) */ rc_user_text AS user_name, rc_user_text, MAX(rc_user) AS user_id, COUNT(*) AS recentedits FROM `recentchanges` FORCE INDEX (rc_user_text) WHERE (rc_user > 0) AND (rc_log_type IS NULL OR rc_log_type != 'newusers') AND (rc_timestamp >= '?') AND (NOT EXISTS (SELECT 1 FROM `ipblocks` WHERE (rc_user=ipb_user) AND ipb_deleted = '1' )) AND (rc_user_text >= '?') GROUP BY rc_user_text ORDER BY rc_user_text LIMIT 101;

Without the rc_user_text >= '?' clause the query executes in seconds. With the clause it takes minutes. Removing the FORCE INDEX doesn't help.

EXPLAIN from an enwiki slave:

*************************** 1. row ***************************
           id: 1
  select_type: PRIMARY
        table: recentchanges
         type: range
possible_keys: rc_user_text
          key: rc_user_text
      key_len: 273
          ref: NULL
         rows: 4013039  <-- eek!
        Extra: Using index condition; Using where
*************************** 2. row ***************************
           id: 2
  select_type: DEPENDENT SUBQUERY
        table: ipblocks
         type: ref
possible_keys: ipb_user
          key: ipb_user
      key_len: 4
          ref: enwiki.recentchanges.rc_user
         rows: 1
        Extra: Using where
2 rows in set (0.25 sec)

The functionality to specify a starting rc_user_text value should be disabled, or the page redesigned.
Comment 1 Sean Pringle 2014-01-13 08:07:54 UTC
Slight correction: even without the clause the query shows up in the slow logs sometimes. It switches to an index scan on rc_user_text and is quite slow as LIMIT increases (eg, 101 to 501).
Comment 2 Aaron Schulz 2014-02-18 20:35:04 UTC
Fixed in 87be24dbdf8235e381110393011b86e0f5be395f

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links