A staff mentioned that rejecting moderated user signups was getting quite slow. I rejected 1 spam user, and observed it taking ~17 seconds for the user to be rejected. Of this time, ~14.2 seconds is just 2 queries.
It looks like when a moderated user is rejected (ie deleted), the following two queries occur:
In both cases, it isn't using any indexes.
The user revert functionality (XenForo_Model_EditHistory::getEditHistoryByUserSinceDate) manages to avoid this as it matches on the edit_date index.
I've added the following indexes which help:
It looks like when a moderated user is rejected (ie deleted), the following two queries occur:
Code:
# Query_time: 11.764225 Lock_time: 0.000027 Rows_sent: 0 Rows_examined: 318519
SET timestamp=1420733968;
UPDATE IGNORE xf_edit_history
SET edit_user_id = 0
WHERE edit_user_id = '312133';
Code:
# Query_time: 2.560013 Lock_time: 0.000020 Rows_sent: 0 Rows_examined: 493988
UPDATE IGNORE xf_user_alert
SET user_id = 0,username = 'SpamSignup'
WHERE user_id = '312133';
In both cases, it isn't using any indexes.
The user revert functionality (XenForo_Model_EditHistory::getEditHistoryByUserSinceDate) manages to avoid this as it matches on the edit_date index.
I've added the following indexes which help:
Code:
alter table xf_user_alert add index `user_id` (`user_id`);
alter table xf_edit_history add index `edit_user_id` (`edit_user_id`);