The page https://undertale-au-fanon.fandom.com/wiki/Special:RecentChanges is extremely slow (15+ seconds) to load for users with rollback rights. The wiki is running on MW 1.33 and Percona Server for MySQL 5.7.
Some brief profiling implicates queries from Linker::getRollbackEditCount. It looks like this query can take several seconds to execute due to index forcing generating a suboptimal execution plan:
MySQL [undertaleaufanon]> explain SELECT rev_user_text,rev_deleted FROM `revision` FORCE INDEX (page_timestamp) JOIN `revision_comment_temp` `temp_rev_comment` ON ((temp_rev_comment.revcomment_rev = rev_id)) JOIN `comment` `comment_rev_comment` ON ((comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id)) WHERE rev_page = '80' ORDER BY rev_timestamp DESC LIMIT 11\G; *************************** 1. row *************************** id: 1 select_type: SIMPLE table: temp_rev_comment partitions: NULL type: index possible_keys: PRIMARY,revcomment_rev key: revcomment_rev key_len: 4 ref: NULL rows: 1 filtered: 100.00 Extra: Using index; Using temporary; Using filesort *************************** 2. row *************************** id: 1 select_type: SIMPLE table: comment_rev_comment partitions: NULL type: eq_ref possible_keys: PRIMARY key: PRIMARY key_len: 8 ref: undertaleaufanon.temp_rev_comment.revcomment_comment_id rows: 1 filtered: 100.00 Extra: Using index *************************** 3. row *************************** id: 1 select_type: SIMPLE table: revision partitions: NULL type: ref possible_keys: page_timestamp key: page_timestamp key_len: 4 ref: const rows: 584 filtered: 100.00 Extra: Using index condition 3 rows in set, 1 warning (0.11 sec)
When I remove the index forcing the query plan is significantly improved:
MySQL [undertaleaufanon]> explain SELECT rev_user_text,rev_deleted FROM `revision` JOIN `revision_comment_temp` `temp_rev_comment` ON ((temp_rev_comment.revcomment_rev = rev_id)) JOIN `comment` `comment_rev_comment` ON ((comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id)) WHERE rev_page = '80' ORDER BY rev_timestamp DESC LIMIT 11\G; *************************** 1. row *************************** id: 1 select_type: SIMPLE table: revision partitions: NULL type: ALL possible_keys: PRIMARY,page_timestamp,page_user_timestamp,rev_page_id key: NULL key_len: NULL ref: NULL rows: 1 filtered: 100.00 Extra: Using where; Using filesort *************************** 2. row *************************** id: 1 select_type: SIMPLE table: temp_rev_comment partitions: NULL type: eq_ref possible_keys: PRIMARY,revcomment_rev key: revcomment_rev key_len: 4 ref: undertaleaufanon.revision.rev_id rows: 1 filtered: 100.00 Extra: Using index *************************** 3. row *************************** id: 1 select_type: SIMPLE table: comment_rev_comment partitions: NULL type: eq_ref possible_keys: PRIMARY key: PRIMARY key_len: 8 ref: undertaleaufanon.temp_rev_comment.revcomment_comment_id rows: 1 filtered: 100.00 Extra: Using index 3 rows in set, 1 warning (0.11 sec)
First query takes 5+ seconds to execute, second query completes in below 100ms.