Last modified: 2014-02-26 00:50:21 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 T63889, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 61889 - ApiQueryLogEvents STRAIGHT_JOIN queries slow
ApiQueryLogEvents STRAIGHT_JOIN queries slow
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.23.0
All All
: High major (vote)
: ---
Assigned To: Nobody - You can work on this!
: performance
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-25 02:56 UTC by Sean Pringle
Modified: 2014-02-26 00:50 UTC (History)
5 users (show)

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


Attachments

Description Sean Pringle 2014-02-25 02:56:15 UTC
enwiki has been seeing a bunch of slow ApiQueryLogEvents queries:

SELECT /* ApiQueryLogEvents::execute */ /*! STRAIGHT_JOIN */ log_type, log_action, log_timestamp, log_deleted, log_id, page_id, log_user, log_user_text, user_name, log_namespace, log_title, log_comment, log_params FROM `logging` LEFT JOIN `user` ON ((user_id=log_user)) LEFT JOIN `page` ON ((log_namespace=page_namespace) AND (log_title=page_title)) INNER JOIN `change_tag` ON ((log_id=ct_log_id)) WHERE (log_type != 'suppress') AND ct_tag = 'Possible self promotion in userspace' ORDER BY log_timestamp DESC LIMIT 11

SELECT /* ApiQueryLogEvents::execute */ /*! STRAIGHT_JOIN */ log_type, log_action, log_timestamp, log_deleted, log_namespace, log_title, ts_tags FROM `logging` LEFT JOIN `user` ON ((user_id=log_user)) LEFT JOIN `page` ON ((log_namespace=page_namespace) AND (log_title=page_title)) LEFT JOIN `tag_summary` ON ((log_id=ts_log_id)) INNER JOIN `change_tag` ON ((log_id=ct_log_id)) WHERE (log_type != 'suppress') AND ct_tag = 'VisualEditor' ORDER BY log_timestamp DESC LIMIT 11

... and several other similar forms.

In all cases the STRAIGHT_JOIN forces an index scan on logging.times index, or more rarely a range access on logging.type_time index. Both query plans hit tens of millions of rows and take many minutes.

Removing the STRAIGHT_JOIN allows the MariaDB query optimizer to choose a plan that takes seconds. Often it includes a filesort step, but more importantly it allows "index condition pushdown" which makes the filesort cheap.
Comment 1 Gerrit Notification Bot 2014-02-25 15:06:50 UTC
Change 115381 had a related patch set uploaded by Anomie:
Remove STRAIGHT_JOIN from ApiQueryLogEvents

https://gerrit.wikimedia.org/r/115381
Comment 2 Gerrit Notification Bot 2014-02-26 00:49:11 UTC
Change 115381 merged by Springle:
Remove STRAIGHT_JOIN from ApiQueryLogEvents

https://gerrit.wikimedia.org/r/115381

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


Navigation
Links