Last modified: 2014-05-21 18:42:15 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 T65777, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 63777 - archive_userindex on replication server not indexed well. Takes 10s of seconds to execute a query.
archive_userindex on replication server not indexed well. Takes 10s of secon...
Status: RESOLVED FIXED
Product: Wikimedia Labs
Classification: Unclassified
Other (Other open bugs)
unspecified
All All
: High normal
: ---
Assigned To: Sean Pringle
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-10 16:03 UTC by Cyberpower678
Modified: 2014-05-21 18:42 UTC (History)
7 users (show)

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


Attachments

Description Cyberpower678 2014-04-10 16:03:06 UTC
Executing a query involving the use of ar_user is very slow.  

Executing SELECT COUNT(*) AS count FROM archive_userindex WHERE `ar_user` ='14836860'; returns:

+-------+
| count |
+-------+
|   344 |
+-------+
1 row in set (16.76 sec)

Executing SELECT COUNT(*) AS count FROM archive_userindex WHERE `ar_user_text` ='Cyberpower678'; returns:

+-------+
| count |
+-------+
|   344 |
+-------+
1 row in set (0.08 sec)
 
Why not use ar_user_text?  I have very good reasons, but it's beside the point.
Comment 1 Cyberpower678 2014-05-04 22:16:59 UTC
BUMP.  I've opened this almost a month ago with no initial comments.  Revision_userindex has a similar problem, but not as severe.  Load times are incredibly high at first but speed up if reloaded immediately after.  However, if you wait a few hours, load times increase again.
Comment 2 Cyberpower678 2014-05-04 23:30:30 UTC
For clarity I'm not trying to use rev_user_text, or ar_user_text.
Comment 3 metatron 2014-05-05 00:53:42 UTC
Esisting Indeces on revision table:

  PRIMARY KEY (`rev_page`,`rev_id`),
  UNIQUE KEY `rev_id` (`rev_id`),
  KEY `rev_timestamp` (`rev_timestamp`),
  KEY `page_timestamp` (`rev_page`,`rev_timestamp`),
  KEY `user_timestamp` (`rev_user`,`rev_timestamp`),
  KEY `usertext_timestamp` (`rev_user_text`,`rev_timestamp`,`rev_user`,`rev_deleted`,`rev_minor_edit`,`rev_text_id`,`rev_comment`)


Existing Indeces on archive table:

  PRIMARY KEY (`ar_id`),
  KEY `name_title_timestamp` (`ar_namespace`,`ar_title`,`ar_timestamp`),
  KEY `usertext_timestamp` (`ar_user_text`,`ar_timestamp`),
  KEY `ar_revid` (`ar_rev_id`)


=> please provide additional index on archive table
  KEY `user_timestamp` (`ar_user`,`ar_timestamp`)

by analogy to revision table.
Comment 4 metatron 2014-05-05 00:57:02 UTC
s/Indeces/Indices/
Comment 5 metatron 2014-05-05 01:15:45 UTC
Additional explanation on this (as Cyberpower678 pointed out)

`rev_user_text` && `ar_user_text` may give wrong results, if a user has been renamed
Comment 6 Sean Pringle 2014-05-05 01:46:21 UTC
Adding the index should be OK.
Comment 7 Sean Pringle 2014-05-12 04:39:43 UTC
A user_timestamp index has been added the archive base tables on labdb100[123] for all wikis.
Comment 8 Cyberpower678 2014-05-12 11:03:33 UTC
(In reply to Sean Pringle from comment #7)
> A user_timestamp index has been added the archive base tables on
> labdb100[123] for all wikis.

Awesome sauce.  Now I just need to wait for the new internet to arrive at my new house, and I can make the changes.
Comment 9 Cyberpower678 2014-05-21 18:41:32 UTC
(In reply to Sean Pringle from comment #7)
> A user_timestamp index has been added the archive base tables on
> labdb100[123] for all wikis.

Thanks for the fix, but I think revision might still have some performance issues.

[time] => 153.57
[query] => SELECT rev_timestamp, page_title, page_namespace FROM revision_userindex JOIN page ON page_id = rev_page WHERE `rev_user` ='82835' AND `rev_timestamp` > 1 ORDER BY rev_timestamp ASC LIMIT 0,2698492;
[result] => succeeded

was returned by my tool in a debug report.
Comment 10 Cyberpower678 2014-05-21 18:42:15 UTC
Take note that the time field is in seconds it took to execute the query.

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


Navigation
Links